From: Sebastian Stark Date: Tue, 20 May 2008 15:22:00 +0000 (+0200) Subject: remove memory leak in scan_dir() X-Git-Tag: v0.0.2~44 X-Git-Url: http://git.tuebingen.mpg.de/?p=adu.git;a=commitdiff_plain;h=75d0800df841a2fd0da1fb6a7e818b3534b22db3;hp=df32293ac0a021f4d46c924e842c2d89a2463ae6 remove memory leak in scan_dir() the tmp pointer is used only for directory entries. However, it was allocated unconditionally and was not freed in case of regular files. --- diff --git a/adu.c b/adu.c index b311a38..03df3e1 100644 --- a/adu.c +++ b/adu.c @@ -414,8 +414,8 @@ int scan_dir(char *dirname) m = s.st_mode; if (!S_ISREG(m) && !S_ISDIR(m)) continue; - tmp = make_message("%s/%s", dirname, entry->d_name); if (S_ISDIR(m)) { + tmp = make_message("%s/%s", dirname, entry->d_name); ret = scan_dir(tmp); free(tmp); if (ret < 0)