From: Andreas Schneider Date: Wed, 15 Nov 2017 09:00:52 +0000 (+0100) Subject: s4:samba: Do not segfault if we run into issues X-Git-Tag: talloc-2.1.11~351 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bfafabfb942668328401a3c89fc55b50dc56c209;p=thirdparty%2Fsamba.git s4:samba: Do not segfault if we run into issues Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/source4/smbd/server.c b/source4/smbd/server.c index eef0f7bf3d2..f107350e1af 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -105,8 +105,16 @@ static void cleanup_tmp_files(struct loadparm_context *lp_ctx) { char *path; TALLOC_CTX *mem_ctx = talloc_new(NULL); + if (mem_ctx == NULL) { + exit_daemon("Failed to create memory context", + ENOMEM); + } path = smbd_tmp_path(mem_ctx, lp_ctx, NULL); + if (path == NULL) { + exit_daemon("Failed to cleanup temporary files", + EINVAL); + } recursive_delete(path); talloc_free(mem_ctx);