Commit 0641ab56 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

fix a memory leak in the logger refs[t:2445]

git-svn-id: file:///svn/toku/tokudb@18513 c7de825b-a66e-492c-adef-691d508d4ae1
parent a89af48d
...@@ -85,9 +85,12 @@ static int open_logdir(TOKULOGGER logger, const char *directory) { ...@@ -85,9 +85,12 @@ static int open_logdir(TOKULOGGER logger, const char *directory) {
if (cwd == NULL) if (cwd == NULL)
return -1; return -1;
char *new_log_dir = toku_malloc(strlen(cwd) + strlen(directory) + 2); char *new_log_dir = toku_malloc(strlen(cwd) + strlen(directory) + 2);
if (new_log_dir == NULL) if (new_log_dir == NULL) {
toku_free(cwd);
return -2; return -2;
}
sprintf(new_log_dir, "%s/%s", cwd, directory); sprintf(new_log_dir, "%s/%s", cwd, directory);
toku_free(cwd);
logger->directory = new_log_dir; logger->directory = new_log_dir;
} }
if (logger->directory==0) return errno; if (logger->directory==0) return errno;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment