libafscp: Don't free bogus ptr in ResolvPathFromVol
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 19 Feb 2013 17:30:14 +0000 (17:30 +0000)
committerDerrick Brashear <shadow@your-file-system.com>
Fri, 22 Feb 2013 21:03:33 +0000 (13:03 -0800)
commit735c9cff53bbf6f2b250a719507d7909e77c48e2
tree37680e741bcae8c9cde969a95cb714647d9f9661
parentf82acb79f25ab97b565c74ef64a7d3573a13b682
libafscp: Don't free bogus ptr in ResolvPathFromVol

afscp_ResolvPathFromVol makes a copy of the path passed to it using
strdup. It then iterates across that, removing initial '/' characters.
However, this iteration means that 'p' no longer points to the start
of the allocated memory - when we free 'p', we may actually be freeing
an offset into the block, which will make malloc unhappy.

Make a copy of the result from strdup, and use that to free the block.

Caught by clang-analyzer

Change-Id: I0e7d8c7cf3b70baa4868c65fb4c3a32474557628
Reviewed-on: http://gerrit.openafs.org/9196
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/libafscp/afscp_dir.c