commit 6e0856ba50f76742c443fe2e47d802261502306b
parent 0171c23bde9ab928be51b16e84137255173eb72c
Author: Ricardo Mones <ricardo@mones.org>
Date: Sat, 10 Feb 2024 19:30:08 +0100
Fix CIDs 1220325, 1491306 and 1491315
Three instances of "Explicit null dereferenced (FORWARD_NULL)"
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/msgcache.c b/src/msgcache.c
@@ -1105,15 +1105,18 @@ static void msgcache_write_func(gpointer key, gpointer value, gpointer user_data
gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar *tags_file, MsgCache *cache)
{
struct write_fps write_fps;
- gchar *new_cache, *new_mark, *new_tags;
+ gchar *new_cache = NULL, *new_mark = NULL, *new_tags = NULL;
int w_err = 0, wrote = 0;
START_TIMING("");
cm_return_val_if_fail(cache != NULL, -1);
- new_cache = g_strconcat(cache_file, ".new", NULL);
- new_mark = g_strconcat(mark_file, ".new", NULL);
- new_tags = g_strconcat(tags_file, ".new", NULL);
+ if (cache_file)
+ new_cache = g_strconcat(cache_file, ".new", NULL);
+ if (mark_file)
+ new_mark = g_strconcat(mark_file, ".new", NULL);
+ if (tags_file)
+ new_tags = g_strconcat(tags_file, ".new", NULL);
write_fps.error = 0;
write_fps.cache_size = 0;