smbget: Fix file descriptor leak.
authorAndreas Schneider <asn@samba.org>
Wed, 20 Feb 2013 09:23:45 +0000 (10:23 +0100)
committerAlexander Bokovoy <ab@samba.org>
Fri, 22 Feb 2013 15:36:14 +0000 (16:36 +0100)
Reviewed-by: Alexander Bokovoy <ab@samba.org>
source3/utils/smbget.c

index 207746f5d4b0f2f8ba6dea954ed1b3a130e467d3..5cb6849bf7dcfd9ea700875d0e1e0e27079c7180 100644 (file)
@@ -449,6 +449,9 @@ static int smb_download_file(const char *base, const char *name, int recursive,
 
        readbuf = (char *)SMB_MALLOC(blocksize);
        if (!readbuf) {
+               if (localhandle != STDOUT_FILENO) {
+                       close(localhandle);
+               }
                return 1;
        }