s4-client: Don't leak resource handle.
authorAndreas Schneider <asn@samba.org>
Wed, 20 Feb 2013 07:58:02 +0000 (08:58 +0100)
committerAlexander Bokovoy <ab@samba.org>
Fri, 22 Feb 2013 15:36:13 +0000 (16:36 +0100)
Reviewed-by: Alexander Bokovoy <ab@samba.org>
source4/client/client.c

index 9985338477ad0a78452f25f66bea5a5b39887247..1dc5b6dd017e892ccb7339cf65a8766d66ba051f 100644 (file)
@@ -1130,6 +1130,7 @@ static int do_put(struct smbclient_context *ctx, char *rname, char *lname, bool
                if (f && reput) {
                        if (x_tseek(f, start, SEEK_SET) == -1) {
                                d_printf("Error seeking local file\n");
+                               x_fclose(f);
                                return 1;
                        }
                }
@@ -1147,6 +1148,7 @@ static int do_put(struct smbclient_context *ctx, char *rname, char *lname, bool
        buf = (uint8_t *)malloc(maxwrite);
        if (!buf) {
                d_printf("ERROR: Not enough memory!\n");
+               x_fclose(f);
                return 1;
        }
        while (!x_feof(f)) {