From: Vsevolod Stakhov Date: Mon, 23 May 2016 17:17:59 +0000 (+0100) Subject: [Fix] Free the correct pointer X-Git-Tag: 1.3.0~448 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1fe4fe45afa7d6749e1dbb1e95d2371120830a4c;p=rspamd.git [Fix] Free the correct pointer --- diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 6c7289fee..cbea7d7f1 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -890,7 +890,7 @@ rspamd_fuzzy_mirror_process_update (struct fuzzy_master_update_session *session, struct rspamd_http_message *msg) { const guchar *p; - gchar *src = NULL; + gchar *src = NULL, *psrc; gsize remain; guint32 revision, our_rev, len, cnt = 0; struct fuzzy_peer_cmd cmd, *pcmd; @@ -909,7 +909,8 @@ rspamd_fuzzy_mirror_process_update (struct fuzzy_master_update_session *session, /* Detect source from url: /update_v1/, so we look for the last '/' */ remain = msg->url->len; - src = rspamd_fstringdup (msg->url); + psrc = rspamd_fstringdup (msg->url); + src = psrc; while (remain--) { if (src[remain] == '/') { @@ -938,7 +939,7 @@ rspamd_fuzzy_mirror_process_update (struct fuzzy_master_update_session *session, if (revision <= our_rev) { msg_err ("remote revision:d %d is older than ours: %d, refusing update", revision, our_rev); - g_free (src); + g_free (psrc); return; } @@ -1027,7 +1028,7 @@ rspamd_fuzzy_mirror_process_update (struct fuzzy_master_update_session *session, " revision: %ud", cnt, revision); err: - g_free (src); + g_free (psrc); if (updates) { /* We still need to clear queue */