From 2f0dd658c407410890ec271b62eec9c9cba5edef Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Tue, 30 Mar 2004 22:58:57 -0300 Subject: [PATCH] Calls to strdup() alloc memory using malloc(), and there's a leak because we never free() it. This patch fixes this by simply freeing the allocated memory. Calls to strdup() alloc memory using malloc(), and there's a leak because we never free() it. This patch fixes this by simply freeing the allocated memory. Thanks to David Hill for reporting this bug. --- libjio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libjio.c b/libjio.c index 1601965..a6fa8db 100644 --- a/libjio.c +++ b/libjio.c @@ -118,6 +118,9 @@ static int get_jdir(char *filename, char *jdir) snprintf(jdir, PATH_MAX, "%s/.%s.jio", dir, base); + free(baset); + free(dirt); + return 1; } @@ -139,6 +142,9 @@ static int get_jtfile(char *filename, int tid, char *jtfile) snprintf(jtfile, PATH_MAX, "%s/.%s.jio/%d", dir, base, tid); + free(baset); + free(dirt); + return 1; } -- 2.11.4.GIT