lib/base log_file should free filename in all cases
once we've used the filename we built, free it before exit
This commit is contained in:

committed by
Nico Williams

parent
59d132f825
commit
c295233648
@@ -234,13 +234,13 @@ log_file(heim_context context, const char *timestr, const char *msg, void *data)
|
|||||||
if (heim_expand_path_tokens(context, f->filename, 1, &filename, NULL))
|
if (heim_expand_path_tokens(context, f->filename, 1, &filename, NULL))
|
||||||
return;
|
return;
|
||||||
fd = open(filename, flags, 0666);
|
fd = open(filename, flags, 0666);
|
||||||
|
free(filename);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
if (f->disp == FILEDISP_IFEXISTS)
|
if (f->disp == FILEDISP_IFEXISTS)
|
||||||
gettimeofday(&f->tv, NULL);
|
gettimeofday(&f->tv, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
f->fd = fdopen(fd, f->mode);
|
f->fd = fdopen(fd, f->mode);
|
||||||
free(filename);
|
|
||||||
}
|
}
|
||||||
if (f->fd == NULL)
|
if (f->fd == NULL)
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user