git » libjio » commit 76715c9

Free a strdup()ed buffer on an error condition

author Alberto Bertogli
2009-02-25 06:15:16 UTC
committer Alberto Bertogli
2009-02-25 07:48:31 UTC
parent b3617834242ae8330836f305945627da57a62210

Free a strdup()ed buffer on an error condition

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

common.c +3 -1

diff --git a/common.c b/common.c
index 5f58ca3..c37f144 100644
--- a/common.c
+++ b/common.c
@@ -114,8 +114,10 @@ int get_jdir(const char *filename, char *jdir)
 	base = basename(baset);
 
 	dirt = strdup(filename);
-	if (dirt == NULL)
+	if (dirt == NULL) {
+		free(baset);
 		return 0;
+	}
 	dir = dirname(dirt);
 
 	snprintf(jdir, PATH_MAX, "%s/.%s.jio", dir, base);