vos: don't free stack garbage on error
authorGarrett Wollman <wollman@csail.mit.edu>
Sun, 7 Aug 2011 03:15:14 +0000 (23:15 -0400)
committerDerrick Brashear <shadow@dementia.org>
Sun, 7 Aug 2011 15:55:05 +0000 (08:55 -0700)
If wantExtendedInfo is true, then pntr is used uninitialized.
In the other case, UV_ListVolumes will have set it to NULL
before doing anything (even if it returns an error), so this
free() is dead anyway.

Change-Id: I6979a69d33ecbbdb906eb9a075bbf13180e36646
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5164
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/volser/vos.c

index 9f19b27..c8bd251 100644 (file)
@@ -3718,8 +3718,6 @@ ListVolumes(struct cmd_syndesc *as, void *arock)
                                   &pntr, &count);
            if (code) {
                PrintDiagnostics("listvol", code);
-               if (pntr)
-                   free(pntr);
                exit(1);
            }
            if (wantExtendedInfo) {