From f82acb79f25ab97b565c74ef64a7d3573a13b682 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 19 Feb 2013 17:28:12 +0000 Subject: [PATCH] libafscp: Fix leak when afscp_ResolvPath errors If afscp_DefaultCell fails, then afscp_ResolvPath returns without freeing the memory allocated to 'p' by strdup. Fix this by adding a free() in the appropriate place. Caught by clang-analyzer Change-Id: Ic2691d209c913cd600d9a9a1ebb4614dff35aa3b Reviewed-on: http://gerrit.openafs.org/9195 Reviewed-by: Derrick Brashear Tested-by: BuildBot --- src/libafscp/afscp_dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libafscp/afscp_dir.c b/src/libafscp/afscp_dir.c index 852a59fd4..ff0538701 100644 --- a/src/libafscp/afscp_dir.c +++ b/src/libafscp/afscp_dir.c @@ -713,6 +713,7 @@ afscp_ResolvePath(const char *path) } cell = afscp_DefaultCell(); if (cell == NULL) { + free(p); afscp_errno = EINVAL; return NULL; } -- 2.39.5