s4:samba: Do not segfault if we run into issues
authorAndreas Schneider <asn@samba.org>
Wed, 15 Nov 2017 09:00:52 +0000 (10:00 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 28 Nov 2017 10:37:06 +0000 (11:37 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/smbd/server.c

index eef0f7bf3d20a5425e50f604d64000b9b938bb8f..f107350e1af09c01edc1e47008d1ab59b87173d3 100644 (file)
@@ -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);