From 75d0800df841a2fd0da1fb6a7e818b3534b22db3 Mon Sep 17 00:00:00 2001
From: Sebastian Stark <stark@ranga.kyb.local>
Date: Tue, 20 May 2008 17:22:00 +0200
Subject: [PATCH] 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.
---
 adu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)
-- 
2.39.5