From 4041c2d64024f27488461e03fcd587dfbb34c4b0 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 18 Sep 2021 12:29:57 +0100 Subject: [Minor] Plug some leaks on error paths Found by: coverity scan --- src/libserver/maps/map.c | 2 ++ src/libserver/maps/map_helpers.c | 1 + 2 files changed, 3 insertions(+) (limited to 'src/libserver/maps') diff --git a/src/libserver/maps/map.c b/src/libserver/maps/map.c index f324f9d70..eaf7958f8 100644 --- a/src/libserver/maps/map.c +++ b/src/libserver/maps/map.c @@ -596,6 +596,8 @@ read_map_file_chunks (struct rspamd_map *map, struct map_cb_data *cbdata, if (lseek (fd, off, SEEK_SET) == -1) { msg_err_map ("can't seek in map to pos %d for buffered reading %s: %s", (gint)off, fname, strerror (errno)); + close (fd); + return FALSE; } diff --git a/src/libserver/maps/map_helpers.c b/src/libserver/maps/map_helpers.c index f98e4dafc..51bc9710c 100644 --- a/src/libserver/maps/map_helpers.c +++ b/src/libserver/maps/map_helpers.c @@ -1868,6 +1868,7 @@ rspamd_cdb_list_read (gchar *chunk, cdb = g_malloc0 (sizeof (struct cdb)); if (cdb_init (cdb, fd) == -1) { + g_free (cdb); msg_err_map ("cannot init cdb map from %s: %s", chunk, strerror (errno)); return NULL; -- cgit v1.2.3