commit 775969a2280ad57011b67d69fea4ce9c4204871a
parent fd46516b6b76cea257b986a0d91360786e55ce08
Author: wwp <subscript@free.fr>
Date: Mon, 10 Mar 2025 00:30:49 +0100
Attempt to fix CID 1491271 Resource leak.
Diffstat:
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/msgcache.c b/src/msgcache.c
@@ -697,9 +697,15 @@ MsgCache *msgcache_read_cache(FolderItem *item, const gchar *cache_file)
GET_CACHE_DATA(ref, memusage);
- if (ref && *ref)
- msginfo->references =
- g_slist_prepend(msginfo->references, ref);
+ if (ref) {
+ if (*ref) {
+ msginfo->references =
+ g_slist_prepend(msginfo->references, ref);
+ } else {
+ g_free(ref);
+ ref = NULL;
+ }
+ }
}
if (msginfo->references)
msginfo->references =
@@ -747,9 +753,15 @@ MsgCache *msgcache_read_cache(FolderItem *item, const gchar *cache_file)
READ_CACHE_DATA(ref, fp, memusage);
- if (ref && *ref)
- msginfo->references =
- g_slist_prepend(msginfo->references, ref);
+ if (ref) {
+ if (*ref) {
+ msginfo->references =
+ g_slist_prepend(msginfo->references, ref);
+ } else {
+ g_free(ref);
+ ref = NULL;
+ }
+ }
}
if (msginfo->references)
msginfo->references =