tools/dumpscan/pathname.c: properly check strdup() return value
authorNickolai Zeldovich <nickolai@csail.mit.edu>
Sun, 6 Jan 2013 04:45:11 +0000 (23:45 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Sun, 6 Jan 2013 16:34:40 +0000 (08:34 -0800)
Fix the check for strdup() running out of memory.

Change-Id: I4e2d83036095c7b292ee4c386d8ed7b16ec75067
Reviewed-on: http://gerrit.openafs.org/8880
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/tools/dumpscan/pathname.c

index db24588..b4d4e5c 100644 (file)
@@ -278,7 +278,7 @@ Path_Build(XFILE * X, path_hashinfo * phi, afs_uint32 vnode, char **his_path,
 
     if (vnode == 1) {
        *his_path = strdup("/");
-       if (!his_path) {
+       if (!*his_path) {
            if (phi->p->cb_error)
                (phi->p->cb_error) (ENOMEM, 1, phi->p->err_refcon,
                                    "No memory for pathname of vnode 1");