]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
libafscp: Fix leak when afscp_ResolvPath errors
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 19 Feb 2013 17:28:12 +0000 (17:28 +0000)
committerDerrick Brashear <shadow@your-file-system.com>
Fri, 22 Feb 2013 21:03:26 +0000 (13:03 -0800)
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 <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/libafscp/afscp_dir.c

index 852a59fd42a0f155e25dffc9da1179262d98fe8f..ff0538701634dea9885344e27221d72d4cf0b009 100644 (file)
@@ -713,6 +713,7 @@ afscp_ResolvePath(const char *path)
     }
     cell = afscp_DefaultCell();
     if (cell == NULL) {
+       free(p);
        afscp_errno = EINVAL;
        return NULL;
     }