Commit 177a858b authored by Nicolas Dufresne's avatar Nicolas Dufresne

v4l2object: Don't leak the par value

parent a76da0ca
......@@ -644,13 +644,17 @@ gst_v4l2_object_set_property_helper (GstV4l2Object * v4l2object,
break;
}
case PROP_PIXEL_ASPECT_RATIO:
g_free (v4l2object->par);
if (v4l2object->par) {
g_value_unset (v4l2object->par);
g_free (v4l2object->par);
}
v4l2object->par = g_new0 (GValue, 1);
g_value_init (v4l2object->par, GST_TYPE_FRACTION);
if (!g_value_transform (value, v4l2object->par)) {
g_warning ("Could not transform string to aspect ratio");
gst_value_set_fraction (v4l2object->par, 1, 1);
}
GST_DEBUG_OBJECT (v4l2object->element, "set PAR to %d/%d",
gst_value_get_fraction_numerator (v4l2object->par),
gst_value_get_fraction_denominator (v4l2object->par));
......@@ -880,6 +884,12 @@ gst_v4l2_object_close (GstV4l2Object * v4l2object)
gst_v4l2_object_clear_format_list (v4l2object);
}
if (v4l2object->par) {
g_value_unset (v4l2object->par);
g_free (v4l2object->par);
v4l2object->par = NULL;
}
return TRUE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment