From: Stefan Metzmacher Date: Thu, 24 May 2018 15:40:27 +0000 (+0200) Subject: printing: add an explicit talloc_stackframe() to delete_driver_files() X-Git-Tag: tevent-0.9.37~347 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e56bb427d3d21ef03fa50a114c377d837de5f3bb;p=thirdparty%2Fsamba.git printing: add an explicit talloc_stackframe() to delete_driver_files() This makes further changes simpler. Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 62ce5752747..9d1a18213cb 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -2053,6 +2053,7 @@ err_out: bool delete_driver_files(const struct auth_session_info *session_info, const struct spoolss_DriverInfo8 *r) { + TALLOC_CTX *frame = talloc_stackframe(); const char *short_arch; connection_struct *conn; NTSTATUS nt_status; @@ -2062,30 +2063,34 @@ bool delete_driver_files(const struct auth_session_info *session_info, bool ret = false; if (!r) { + TALLOC_FREE(frame); return false; } DEBUG(6,("delete_driver_files: deleting driver [%s] - version [%d]\n", r->driver_name, r->version)); - printdollar_snum = find_service(talloc_tos(), "print$", &printdollar); + printdollar_snum = find_service(frame, "print$", &printdollar); if (!printdollar) { + TALLOC_FREE(frame); return false; } if (printdollar_snum == -1) { + TALLOC_FREE(frame); return false; } - nt_status = create_conn_struct_cwd(talloc_tos(), + nt_status = create_conn_struct_cwd(frame, server_event_context(), server_messaging_context(), &conn, printdollar_snum, - lp_path(talloc_tos(), printdollar_snum), + lp_path(frame, printdollar_snum), session_info, &oldcwd_fname); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0,("delete_driver_files: create_conn_struct " "returned %s\n", nt_errstr(nt_status))); + TALLOC_FREE(frame); return false; } @@ -2152,10 +2157,10 @@ bool delete_driver_files(const struct auth_session_info *session_info, err_free_conn: if (conn != NULL) { vfs_ChDir(conn, oldcwd_fname); - TALLOC_FREE(oldcwd_fname); SMB_VFS_DISCONNECT(conn); conn_free(conn); } + TALLOC_FREE(frame); return ret; }