commit 7d04b33: [Minor] Fix leak

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Feb 27 14:28:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-02-26 16:11:37 +0000
URL: https://github.com/rspamd/rspamd/commit/7d04b331647d7738e5c273936ed0155960835bae

[Minor] Fix leak

---
 src/libmime/lang_detection.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/libmime/lang_detection.c b/src/libmime/lang_detection.c
index 9c29212dd..7bfcf0164 100644
--- a/src/libmime/lang_detection.c
+++ b/src/libmime/lang_detection.c
@@ -1471,7 +1471,10 @@ rspamd_language_detector_set_language (struct rspamd_task *task,
 	r->prob = 1.0;
 	r->lang = code;
 
-	part->languages = g_ptr_array_sized_new (1);
+	if (part->languages == NULL) {
+		part->languages = g_ptr_array_sized_new (1);
+	}
+
 	g_ptr_array_add (part->languages, r);
 	part->language = code;
 }


More information about the Commits mailing list