Skip to content

Commit

Permalink
CID #1206501 - Check dup was ok in fr_log_talloc_report
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Apr 26, 2014
1 parent ec482c3 commit 2543ec8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib/debug.c
Expand Up @@ -468,11 +468,16 @@ int fr_log_talloc_report(TALLOC_CTX *ctx)
FILE *log;
char const *null_ctx = NULL;
int i = 0;
int fd;

log = fdopen(dup(fr_fault_log_fd), "w");
fd = dup(fr_fault_log_fd);
if (fd < 0) {
fr_strerror_printf("Couldn't write memory report, failed to dup log fd: %s", fr_syserror(errno));
return -1;
}
log = fdopen(fd, "w");
if (!log) {
fr_strerror_printf("Couldn't write memory report, fdopen failed: %s", fr_syserror(errno));

return -1;
}

Expand Down

0 comments on commit 2543ec8

Please sign in to comment.