From cf071c74aa8e7d2975b08a1271902401890c41f7 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 25 Sep 2021 12:45:29 +0100 Subject: [Minor] Fix some more issues Found by: coverity scan --- src/libserver/maps/map.c | 8 ++++++++ src/libserver/re_cache.c | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/libserver') diff --git a/src/libserver/maps/map.c b/src/libserver/maps/map.c index eaf7958f8..d30b2b40d 100644 --- a/src/libserver/maps/map.c +++ b/src/libserver/maps/map.c @@ -2661,6 +2661,14 @@ err: g_free (hdata); } + if (fdata) { + g_free (fdata); + } + + if (sdata) { + g_free (sdata); + } + return NULL; } diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index 4d631da01..82bbcee1c 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -1889,7 +1889,7 @@ rspamd_re_cache_compile_timer_cb (EV_P_ ev_timer *w, int revents ) guint *hs_flags = NULL; const hs_expr_ext_t **hs_exts = NULL; gchar **hs_pats = NULL; - gchar *hs_serialized; + gchar *hs_serialized = NULL; gsize serialized_len; struct iovec iov[7]; struct rspamd_re_cache *cache; @@ -1918,7 +1918,7 @@ rspamd_re_cache_compile_timer_cb (EV_P_ ev_timer *w, int revents ) /* Read number of regexps */ g_assert (fd != -1); - lseek (fd, RSPAMD_HS_MAGIC_LEN + sizeof (cache->plt), SEEK_SET); + g_assert (lseek (fd, RSPAMD_HS_MAGIC_LEN + sizeof (cache->plt), SEEK_SET) != -1); g_assert (read (fd, &n, sizeof (n)) == sizeof (n)); close (fd); @@ -2212,6 +2212,9 @@ rspamd_re_cache_compile_timer_cb (EV_P_ ev_timer *w, int revents ) (gint)g_hash_table_size (re_class->re), path); + g_free (hs_serialized); + g_free (hs_ids); + g_free (hs_flags); unlink (path); close (fd); rspamd_re_cache_compile_err (EV_A_ w, err, cbdata); -- cgit v1.2.3