ntvfs: Fix CID 1034883 Resource leak
authorVolker Lendecke <vl@samba.org>
Sun, 10 Nov 2013 18:41:15 +0000 (19:41 +0100)
committerIra Cooper <ira@samba.org>
Mon, 11 Nov 2013 20:04:09 +0000 (21:04 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
source4/ntvfs/simple/vfs_simple.c

index 58c8df8dd538a66d085198c17165b948b08f928a..a652494dc17a02cb3e810bd90b4bc78aa99f70fb 100644 (file)
@@ -414,7 +414,10 @@ do_open:
        NT_STATUS_NOT_OK_RETURN(status);
 
        f = talloc(handle, struct svfs_file);
-       NT_STATUS_HAVE_NO_MEMORY(f);
+       if (f == NULL) {
+               close(fd);
+               return NT_STATUS_NO_MEMORY;
+       }
        f->fd = fd;
        f->name = talloc_strdup(f, unix_path);
        NT_STATUS_HAVE_NO_MEMORY(f->name);