summaryrefslogtreecommitdiff
path: root/src/desktop_vec.c
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-12-11 16:57:23 +0000
committerPhil Jones <philj56@gmail.com>2022-12-11 16:57:23 +0000
commit4ac4408ee7d9af91b9f9e3c7734aa2f673ef5cdc (patch)
tree3edbdf3ef587b9c620cacb666b05b454fd810829 /src/desktop_vec.c
parent0efb3c61a9575eede8984f362dfa6cd0b7562f4a (diff)
Fix a couple of cache-generation memory leaks.
Diffstat (limited to 'src/desktop_vec.c')
-rw-r--r--src/desktop_vec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/desktop_vec.c b/src/desktop_vec.c
index de7fcd7..c9a0b86 100644
--- a/src/desktop_vec.c
+++ b/src/desktop_vec.c
@@ -81,7 +81,8 @@ void desktop_vec_add_file(struct desktop_vec *vec, const char *id, const char *p
*/
char *keywords = g_key_file_get_locale_string(file, group, "Keywords", NULL, NULL);
if (keywords == NULL) {
- keywords = "";
+ keywords = xmalloc(1);
+ *keywords = '\0';
}
gsize length;
@@ -91,7 +92,7 @@ void desktop_vec_add_file(struct desktop_vec *vec, const char *id, const char *p
g_strfreev(list);
list = NULL;
if (!match) {
- goto cleanup_name;
+ goto cleanup_all;
}
}
@@ -101,13 +102,14 @@ void desktop_vec_add_file(struct desktop_vec *vec, const char *id, const char *p
g_strfreev(list);
list = NULL;
if (match) {
- goto cleanup_name;
+ goto cleanup_all;
}
}
desktop_vec_add(vec, id, name, path, keywords);
-cleanup_name:
+cleanup_all:
+ free(keywords);
free(name);
cleanup_file:
g_key_file_unref(file);