commit 52041f0: [Minor] Fix some double frees

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Sep 17 21:00:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-09-17 21:47:17 +0100
URL: https://github.com/rspamd/rspamd/commit/52041f014b47aa9f67bbaecda08a0fb18673cb93

[Minor] Fix some double frees
Found by: coverity scan

---
 src/libmime/archives.c | 2 ++
 src/libserver/dns.c    | 1 +
 src/libutil/rrd.c      | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/libmime/archives.c b/src/libmime/archives.c
index 4d7867f67..1101213d1 100644
--- a/src/libmime/archives.c
+++ b/src/libmime/archives.c
@@ -254,6 +254,8 @@ rspamd_archive_process_zip (struct rspamd_task *task,
 		}
 		else {
 			g_free (f);
+
+			return;
 		}
 
 		/* Process extra fields */
diff --git a/src/libserver/dns.c b/src/libserver/dns.c
index c23390a47..0eff240a6 100644
--- a/src/libserver/dns.c
+++ b/src/libserver/dns.c
@@ -652,6 +652,7 @@ rspamd_process_fake_reply (struct rspamd_config *cfg,
 					else {
 						DL_APPEND (replies, rep);
 					}
+					break;
 				case RDNS_REQUEST_SRV:
 				default:
 					msg_err_config ("invalid or unsupported reply element "
diff --git a/src/libutil/rrd.c b/src/libutil/rrd.c
index a270d87c6..09e488f9a 100644
--- a/src/libutil/rrd.c
+++ b/src/libutil/rrd.c
@@ -747,7 +747,7 @@ rspamd_rrd_finalize (struct rspamd_rrd_file *file, GError **err)
 		close (fd);
 		g_set_error (err,
 			rrd_error_quark (), ENOMEM, "mmap failed: %s", strerror (errno));
-		g_free (file);
+
 		return FALSE;
 	}
 


More information about the Commits mailing list