diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2017-09-13 11:52:09 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2017-09-13 11:52:09 -0400 |
commit | c56eb21a82617f2cc54b97dbfb4fc64ba428851c (patch) | |
tree | 6e044d3ac005d0b48f0d9083e6a1f29a854719d9 /sys | |
parent | 3ea2621036ba5481362bd95dfba1553b1308fa70 (diff) |
v4l2object: Don't leak the par value
Diffstat (limited to 'sys')
-rw-r--r-- | sys/v4l2/gstv4l2object.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 57d7b3840..0ececf8b4 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -668,13 +668,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)); @@ -904,6 +908,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; } |