[glib] volume monitor: don't unref NULL
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] volume monitor: don't unref NULL
- Date: Tue, 5 Oct 2010 06:30:43 +0000 (UTC)
commit 1612a4d5065e3505cf45585ffb7e890a06ff27d6
Author: Ryan Lortie <desrt desrt ca>
Date: Tue Oct 5 02:29:47 2010 -0400
volume monitor: don't unref NULL
Fix a couple more cases of blindly calling g_object_unref() on the
result of a function that is documented as sometimes returning NULL.
gio/tests/volumemonitor.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/volumemonitor.c b/gio/tests/volumemonitor.c
index 54123ec..e3fdc3b 100644
--- a/gio/tests/volumemonitor.c
+++ b/gio/tests/volumemonitor.c
@@ -49,7 +49,8 @@ do_volume_tests (GDrive *drive, GVolume *volume)
d = g_volume_get_drive (volume);
g_assert (d == drive);
- g_object_unref (d);
+ if (d != NULL)
+ g_object_unref (d);
mount = g_volume_get_mount (volume);
if (mount != NULL)
@@ -126,7 +127,8 @@ test_volumes (void)
drive = g_volume_get_drive (volume);
do_volume_tests (drive, volume);
- g_object_unref (drive);
+ if (drive != NULL)
+ g_object_unref (drive);
}
g_list_foreach (volumes, (GFunc)g_object_unref, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]