mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-15 04:05:11 +01:00
Merge branch 'gio-tool-set-leak' into 'main'
gio-tool: Fix a minor memory leak when using gio-set with bytestrings See merge request GNOME/glib!2626
This commit is contained in:
commit
4a1ffd1c79
@ -76,12 +76,14 @@ handle_set (int argc, char *argv[], gboolean do_help)
|
|||||||
const char *attribute;
|
const char *attribute;
|
||||||
GFileAttributeType type;
|
GFileAttributeType type;
|
||||||
gpointer value;
|
gpointer value;
|
||||||
|
gpointer value_allocated = NULL;
|
||||||
gboolean b;
|
gboolean b;
|
||||||
guint32 uint32;
|
guint32 uint32;
|
||||||
gint32 int32;
|
gint32 int32;
|
||||||
guint64 uint64;
|
guint64 uint64;
|
||||||
gint64 int64;
|
gint64 int64;
|
||||||
gchar *param;
|
gchar *param;
|
||||||
|
int retval = 0;
|
||||||
|
|
||||||
g_set_prgname ("gio set");
|
g_set_prgname ("gio set");
|
||||||
|
|
||||||
@ -147,7 +149,7 @@ handle_set (int argc, char *argv[], gboolean do_help)
|
|||||||
value = argv[3];
|
value = argv[3];
|
||||||
break;
|
break;
|
||||||
case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING:
|
case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING:
|
||||||
value = hex_unescape (argv[3]);
|
value = value_allocated = hex_unescape (argv[3]);
|
||||||
break;
|
break;
|
||||||
case G_FILE_ATTRIBUTE_TYPE_BOOLEAN:
|
case G_FILE_ATTRIBUTE_TYPE_BOOLEAN:
|
||||||
b = g_ascii_strcasecmp (argv[3], "true") == 0;
|
b = g_ascii_strcasecmp (argv[3], "true") == 0;
|
||||||
@ -194,11 +196,11 @@ handle_set (int argc, char *argv[], gboolean do_help)
|
|||||||
{
|
{
|
||||||
print_error ("%s", error->message);
|
print_error ("%s", error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
g_object_unref (file);
|
retval = 1;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_clear_pointer (&value_allocated, g_free);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
|
|
||||||
return 0;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user