From cd10d1d13afadef83290529958f56265bca83abf Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 12 Dec 2014 18:18:35 +0100 Subject: [PATCH] Fix small memory leak in names-cache MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomáš Chvátal --- lib/names-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/names-cache.c b/lib/names-cache.c index 90a6454..c97ea30 100644 --- a/lib/names-cache.c +++ b/lib/names-cache.c @@ -39,7 +39,8 @@ static char *get_cache_name(struct pci_access *a) buf = pci_malloc(a, strlen(pw->pw_dir) + strlen(name+1) + 1); sprintf(buf, "%s%s", pw->pw_dir, name+1); pci_set_param_internal(a, "net.cache_name", buf, 0); - return buf; + pci_mfree(buf); + return pci_get_param(a, "net.cache_name"); } int -- 2.1.3 --- lib/names-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/names-cache.c b/lib/names-cache.c index 90a6454..c97ea30 100644 --- a/lib/names-cache.c +++ b/lib/names-cache.c @@ -39,7 +39,8 @@ static char *get_cache_name(struct pci_access *a) buf = pci_malloc(a, strlen(pw->pw_dir) + strlen(name+1) + 1); sprintf(buf, "%s%s", pw->pw_dir, name+1); pci_set_param_internal(a, "net.cache_name", buf, 0); - return buf; + pci_mfree(buf); + return pci_get_param(a, "net.cache_name"); } int -- 2.39.2