ntvfs: Fix CID 1107225 Resource leak
authorVolker Lendecke <vl@samba.org>
Sun, 20 Oct 2013 15:16:11 +0000 (17:16 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 21 Oct 2013 23:34:35 +0000 (16:34 -0700)
After the talloc_strdup, we don't need cwd anymore.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/ntvfs/posix/pvfs_sys.c

index 5775d0bb7790a7e93358deed8d70f1d57567b62d..eb710f66513a67e3165771afad0a1c2fe9f540c6 100644 (file)
@@ -196,9 +196,11 @@ static struct pvfs_sys_ctx *pvfs_sys_pushdir(struct pvfs_state *pvfs,
                talloc_free(ctx);
                return NULL;
        }
+
        ctx->old_wd = talloc_strdup(ctx, cwd);
+       free(cwd);
+
        if (ctx->old_wd == NULL) {
-               free(cwd);
                talloc_free(ctx);
                return NULL;
        }