commit 56413842f2f1dd1de548195aee7377be194bdbe5
parent 8c85b626a0f78960eff5b32ee719b5ea3603f5e2
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Wed, 12 Jul 2017 23:52:06 +0200
Fix a memory leak in get_fingerprint().
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git 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));