afs_pioctl: don't use cell uninitialized in PGetTokens2
authorGarrett Wollman <wollman@csail.mit.edu>
Sun, 7 Aug 2011 04:09:33 +0000 (00:09 -0400)
committerDerrick Brashear <shadow@dementia.org>
Sun, 7 Aug 2011 18:50:19 +0000 (11:50 -0700)
An unlikely error condition could lead to the variable cell in
PGetTokens2 being passed uninitialized to afs_PutCell.  Initialize
it to NULL beforehand to avoid this.

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

src/afs/afs_pioctl.c

index ff3e87d..38a9999 100644 (file)
@@ -5380,7 +5380,7 @@ out:
 
 DECL_PIOCTL(PGetTokens2)
 {
-    struct cell *cell;
+    struct cell *cell = NULL;
     struct unixuser *tu = NULL;
     afs_int32 iterator;
     char *cellName = NULL;