# HG changeset patch # User Mikael Berthe # Date 1224262558 -7200 # Node ID ec55cdf44335b056604bb89b0b87d7fdcd441bfb # Parent 0674abda9a8f288834e0052bf5220a56b1148793 Fix a memory leak in hlog_get_log_jid() diff -r 0674abda9a8f -r ec55cdf44335 mcabber/src/histolog.c --- a/mcabber/src/histolog.c Sat Oct 11 10:56:30 2008 +0200 +++ b/mcabber/src/histolog.c Fri Oct 17 18:55:58 2008 +0200 @@ -70,22 +70,20 @@ char *log_jid = NULL; path = user_histo_file(bjid); - do { + while (path) { if (lstat(path, &bufstat) != 0) break; if (S_ISLNK(bufstat.st_mode)) { g_free(log_jid); - log_jid = g_new(char, bufstat.st_size+1); + log_jid = g_new0(char, bufstat.st_size+1); readlink(path, log_jid, bufstat.st_size); g_free(path); - log_jid[bufstat.st_size] = '\0'; path = user_histo_file(log_jid); - } else { - g_free(path); - path = NULL; - } - } while( path ); + } else + break; + } + g_free(path); return log_jid; }