Skip to content

Commit be5b4c7

Browse files
log: guard free(NULL) in set_log_path()
free(log->path) is called before path has been set on the first invocation, triggering a spurious WARNING from the custom FTLfree() wrapper. Add a NULL check to avoid the noise. Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
1 parent 8e30813 commit be5b4c7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/log.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ static void set_log_path(struct log_fd *log, const char *path)
144144
{
145145
if(log->path != NULL && path != NULL && strcmp(log->path, path) == 0)
146146
return; // unchanged
147-
free(log->path);
147+
if(log->path != NULL)
148+
free(log->path);
148149
log->path = path != NULL ? strdup(path) : NULL;
149150
}
150151

0 commit comments

Comments
 (0)