[tracker/wip/passive-extraction] extract, gst: Ensure GstDiscovererInfo structs aren't leaked



commit 7697fc84b278ce3c7ddc162c7801eaca95411c76
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jan 20 20:11:12 2014 +0100

    extract,gst: Ensure GstDiscovererInfo structs aren't leaked
    
    gst_discoverer_discover_uri() may return a non-NULL error and
    a GstDiscovererInfo pointer, so ensure it is freed in case of
    error. The info was also being leaked on successful extraction,
    that is fixed too.

 src/tracker-extract/tracker-extract-gstreamer.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 1ded93e..59826ee 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -1410,18 +1410,20 @@ discoverer_init_and_run (MetadataExtractor *extractor,
        info = gst_discoverer_discover_uri (extractor->discoverer,
                                            uri,
                                            &error);
+
+       if (!info) {
+               g_warning ("Nothing discovered, bailing out");
+               return TRUE;
+       }
+
        if (error) {
                g_warning ("Call to gst_discoverer_discover_uri() failed: %s",
                           error->message);
+               gst_discoverer_info_unref (info);
                g_error_free (error);
                return FALSE;
        }
 
-       if (!info) {
-               g_warning ("Nothing discovered, bailing out");
-               return TRUE;
-       }
-
 #if defined(GSTREAMER_BACKEND_GUPNP_DLNA)
        {
                GUPnPDLNAProfile *profile;
@@ -1496,6 +1498,8 @@ discoverer_init_and_run (MetadataExtractor *extractor,
                }
        }
 
+       gst_discoverer_info_unref (info);
+
        return TRUE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]