Skip to content

Commit

Permalink
s4:samba: Do not segfault if we run into issues
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Schneider <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
  • Loading branch information
cryptomilk authored and abartlet committed Nov 28, 2017
1 parent deaaff6 commit bfafabf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source4/smbd/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bfafabf

Please sign in to comment.