[gnome-photos] base-item: Avoid pointing to invalid memory
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] base-item: Avoid pointing to invalid memory
- Date: Sat, 9 Jul 2016 13:14:12 +0000 (UTC)
commit 215026f4d199dbf782668d8b7cc5799f5310c6a3
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Jul 8 10:24:22 2016 +0200
base-item: Avoid pointing to invalid memory
When setting a new default GAppInfo we should not only free the old
name, but also NULLify it. Otherwise, if were passed a NULL GAppInfo,
then the pointers to the name and the object would be out of sync. One
would be non-NULL and the other NULL. We would also confuse the NULL
checks and risk accessing invalid memory.
src/photos-base-item.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 5f94198..4c76b23 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -2750,7 +2750,7 @@ photos_base_item_set_default_app (PhotosBaseItem *self, GAppInfo *default_app)
return;
g_clear_object (&priv->default_app);
- g_free (priv->default_app_name);
+ g_clear_pointer (&priv->default_app_name, g_free);
if (default_app == NULL)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]