[libosinfo PATCH 1/4] media: Don't leak stream in case of errors

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

 



stream has to be freed whenever an error occurr on
osinfo_media_create_from_location_async() internals.

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 osinfo/osinfo_media.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index 293732d..ed8db29 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -866,6 +866,7 @@ static void on_pvd_read(GObject *source,
     return;
 
 ON_ERROR:
+    g_object_unref(stream);
     g_task_return_error(data->res, error);
     create_from_location_async_data_free(data);
 }
@@ -888,6 +889,7 @@ static void on_location_skipped(GObject *source,
                         OSINFO_MEDIA_ERROR,
                         OSINFO_MEDIA_ERROR_NO_DESCRIPTORS,
                         _("No volume descriptors"));
+        g_object_unref(stream);
         g_task_return_error(data->res, error);
         create_from_location_async_data_free(data);
 
@@ -919,6 +921,7 @@ static void on_location_read(GObject *source,
     stream = g_file_read_finish(G_FILE(source), res, &error);
     if (error != NULL) {
         g_prefix_error(&error, _("Failed to open file"));
+        g_object_unref(stream);
         g_task_return_error(data->res, error);
         create_from_location_async_data_free(data);
 
-- 
2.19.1

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux