bluez/rsvg: fix memory leak 15/106615/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 22 Dec 2016 02:13:06 +0000 (11:13 +0900)
committereunhae choi <eunhae1.choi@samsung.com>
Thu, 22 Dec 2016 07:49:58 +0000 (23:49 -0800)
Change-Id: I3bc9839624af96ffa8d9f31e8ff230f39209bb43
Signed-off-by: Eunhae Choi <eunhae1.choi@samsung.com>
(cherry picked from commit a5bcbef7e2b4afd530ad341cad133fab8abbe9c6)

ext/rsvg/gstrsvgdec.c
sys/bluez/gstavdtpsrc.c

index 17ebcb1..31ce4e6 100644 (file)
@@ -172,6 +172,7 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer,
   if (!handle) {
     GST_ERROR_OBJECT (rsvg, "Failed to parse SVG image: %s", error->message);
     g_error_free (error);
+    gst_buffer_unmap (buffer, &minfo);
     return GST_FLOW_ERROR;
   }
 
@@ -197,6 +198,7 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer,
     gst_video_codec_state_unref (output_state);
     GST_ERROR_OBJECT (rsvg, "Buffer allocation failed %s",
         gst_flow_get_name (ret));
+    gst_buffer_unmap (buffer, &minfo);
     return ret;
   }
 
@@ -210,6 +212,7 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer,
     GST_ERROR_OBJECT (rsvg, "Failed to get SVG image");
     g_object_unref (handle);
     gst_video_codec_state_unref (output_state);
+    gst_buffer_unmap (buffer, &minfo);
     return GST_FLOW_ERROR;
   }
   surface =
index fee5505..50de8f6 100644 (file)
@@ -199,6 +199,7 @@ gst_avdtp_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
       value = gst_structure_get_value (structure, "mpegversion");
       if (!value || !G_VALUE_HOLDS_INT (value)) {
         GST_ERROR_OBJECT (avdtpsrc, "Failed to get mpegversion");
+        gst_caps_unref (caps);
         return NULL;
       }
       gst_caps_set_simple (caps, "mpegversion", G_TYPE_INT,
@@ -207,6 +208,7 @@ gst_avdtp_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
       value = gst_structure_get_value (structure, "channels");
       if (!value || !G_VALUE_HOLDS_INT (value)) {
         GST_ERROR_OBJECT (avdtpsrc, "Failed to get channels");
+        gst_caps_unref (caps);
         return NULL;
       }
       gst_caps_set_simple (caps, "channels", G_TYPE_INT,
@@ -215,6 +217,7 @@ gst_avdtp_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
       value = gst_structure_get_value (structure, "base-profile");
       if (!value || !G_VALUE_HOLDS_STRING (value)) {
         GST_ERROR_OBJECT (avdtpsrc, "Failed to get base-profile");
+        gst_caps_unref (caps);
         return NULL;
       }
       gst_caps_set_simple (caps, "base-profile", G_TYPE_STRING,
@@ -223,11 +226,13 @@ gst_avdtp_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
     } else {
       GST_ERROR_OBJECT (avdtpsrc,
           "Only SBC and MPEG-2/4 are supported at the moment");
+      return NULL;
     }
 
     value = gst_structure_get_value (structure, "rate");
     if (!value || !G_VALUE_HOLDS_INT (value)) {
       GST_ERROR_OBJECT (avdtpsrc, "Failed to get sample rate");
+      gst_caps_unref (caps);
       return NULL;
     }
     rate = g_value_get_int (value);