Skip to content
Snippets Groups Projects
Commit b6e2655d authored by Moe Jette's avatar Moe Jette
Browse files

Replace several "if(x);xfree(x)" with just "xfree(x)" which already tests

for NULL values. Remove redundant code.
parent 773f9e6f
No related branches found
No related tags found
No related merge requests found
...@@ -227,13 +227,13 @@ int log_init(char *prog, log_options_t opt, log_facility_t fac, char *logfile) ...@@ -227,13 +227,13 @@ int log_init(char *prog, log_options_t opt, log_facility_t fac, char *logfile)
void log_fini() void log_fini()
{ {
if (!log) return; if (!log)
return;
log_flush(); log_flush();
slurm_mutex_lock(&log_lock); slurm_mutex_lock(&log_lock);
if (log->argv0) xfree(log->argv0);
xfree(log->argv0); xfree(log->fpfx);
if (log->fpfx)
xfree(log->fpfx);
if (log->buf) if (log->buf)
cbuf_destroy(log->buf); cbuf_destroy(log->buf);
if (log->fbuf) if (log->fbuf)
...@@ -254,8 +254,7 @@ void log_reinit() ...@@ -254,8 +254,7 @@ void log_reinit()
void log_set_fpfx(char *prefix) void log_set_fpfx(char *prefix)
{ {
slurm_mutex_lock(&log_lock); slurm_mutex_lock(&log_lock);
if (log->fpfx) xfree(log->fpfx);
xfree(log->fpfx);
if (!prefix) if (!prefix)
log->fpfx = xstrdup(""); log->fpfx = xstrdup("");
else { else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment