From: Andrej Kacian Date: Wed, 12 Jul 2017 21:52:06 +0000 (+0200) Subject: Fix a memory leak in get_fingerprint(). X-Git-Tag: 3.16.0~96 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=56413842f2f1dd1de548195aee7377be194bdbe5 Fix a memory leak in get_fingerprint(). --- diff --git a/src/ssl_manager.c b/src/ssl_manager.c index 4a7db9d70..60042cc49 100644 --- a/src/ssl_manager.c +++ b/src/ssl_manager.c @@ -242,7 +242,7 @@ static gboolean get_serverport(const gchar *str, gchar **server, gchar **port) static char *get_fingerprint(const char *str) { - char *ret = NULL, *tmp = g_strdup(str); + char *ret = NULL, *tmp = g_strdup(str), *tmp2 = tmp; char *previous_pos = NULL, *last_pos = NULL; if (!strchr(tmp, ':')) { @@ -251,10 +251,10 @@ static char *get_fingerprint(const char *str) *(strstr(tmp, ".cert")+1) = '.'; } - while (tmp && (tmp = strstr(tmp,".")) != NULL) { - tmp++; + while (tmp2 && (tmp2 = strstr(tmp2,".")) != NULL) { + tmp2++; previous_pos = last_pos; - last_pos = tmp; + last_pos = tmp2; } if (last_pos && previous_pos && (int)(last_pos - previous_pos - 1) > 0) ret = g_strndup(previous_pos, (int)(last_pos - previous_pos - 1));