[Libosinfo] [libosinfo PATCH 1/4] media: Don't leak stream in case of errors
Fabiano Fidêncio
fidencio at redhat.com
Fri Dec 14 09:21:01 UTC 2018
stream has to be freed whenever an error occurr on
osinfo_media_create_from_location_async() internals.
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
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
More information about the Libosinfo
mailing list