[PATCH 6/7] clitar: propagate make_remote_path() talloc errors

David Disseldorp ddiss at samba.org
Thu Feb 20 11:47:49 MST 2014


Signed-off-by: David Disseldorp <ddiss at samba.org>
---
 source3/client/clitar.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 4406f3e..43090ec 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -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, '\\');
-- 
1.8.4.5



More information about the samba-technical mailing list