From: Simon Wilkinson Date: Tue, 19 Feb 2013 17:28:12 +0000 (+0000) Subject: libafscp: Fix leak when afscp_ResolvPath errors X-Git-Tag: upstream/1.8.0_pre1^2~1498 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f82acb79f25ab97b565c74ef64a7d3573a13b682;p=packages%2Fo%2Fopenafs.git 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 --- 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; }