clitar: propagate make_remote_path() talloc errors
authorDavid Disseldorp <ddiss@samba.org>
Thu, 20 Feb 2014 18:47:49 +0000 (19:47 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 20 Feb 2014 23:03:02 +0000 (12:03 +1300)
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/client/clitar.c

index 4406f3ee36b75bfb4cd06e98a6a37f1691b94489..43090ec020c54d8efd48c02a5a12bad3e5afe2e6 100644 (file)
@@ -1593,7 +1593,6 @@ static int set_remote_attr(const char *filename, uint16 new_attr, int mode)
 static int make_remote_path(const char *full_path)
 {
        extern struct cli_state *cli;
-       TALLOC_CTX *ctx = PANIC_IF_NULL(talloc_new(NULL));
        char *path;
        char *subpath;
        char *state;
@@ -1602,9 +1601,21 @@ static int make_remote_path(const char *full_path)
        int len;
        NTSTATUS status;
        int err = 0;
+       TALLOC_CTX *ctx = talloc_new(NULL);
+       if (ctx == NULL) {
+               return 1;
+       }
 
-       subpath = PANIC_IF_NULL(talloc_strdup(ctx, full_path));
-       path = PANIC_IF_NULL(talloc_strdup(ctx, full_path));
+       subpath = talloc_strdup(ctx, full_path);
+       if (subpath == NULL) {
+               err = 1;
+               goto out;
+       }
+       path = talloc_strdup(ctx, full_path);
+       if (path == NULL) {
+               err = 1;
+               goto out;
+       }
        len = talloc_get_size(path) - 1;
 
        last_backslash = strrchr_m(path, '\\');