Skip to content
Snippets Groups Projects
Commit 42fa7322 authored by Morris Jette's avatar Morris Jette
Browse files

Fix possible memory leak in src/log.c on slurm reconfigure

parent a98b849a
No related branches found
No related tags found
No related merge requests found
...@@ -258,10 +258,14 @@ _log_init(char *prog, log_options_t opt, log_facility_t fac, char *logfile ) ...@@ -258,10 +258,14 @@ _log_init(char *prog, log_options_t opt, log_facility_t fac, char *logfile )
log->opt = opt; log->opt = opt;
if (log->buf) if (log->buf) {
cbuf_destroy(log->buf); cbuf_destroy(log->buf);
if (log->fbuf) log->buf = NULL;
}
if (log->fbuf) {
cbuf_destroy(log->fbuf); cbuf_destroy(log->fbuf);
log->fbuf = NULL;
}
if (log->opt.buffered) { if (log->opt.buffered) {
log->buf = cbuf_create(128, 8192); log->buf = cbuf_create(128, 8192);
...@@ -342,10 +346,14 @@ _sched_log_init(char *prog, log_options_t opt, log_facility_t fac, ...@@ -342,10 +346,14 @@ _sched_log_init(char *prog, log_options_t opt, log_facility_t fac,
sched_log->opt = opt; sched_log->opt = opt;
if (sched_log->buf) if (sched_log->buf) {
cbuf_destroy(sched_log->buf); cbuf_destroy(sched_log->buf);
if (sched_log->fbuf) sched_log->buf = NULL;
}
if (sched_log->fbuf) {
cbuf_destroy(sched_log->fbuf); cbuf_destroy(sched_log->fbuf);
sched_log->fbuf = NULL;
}
if (sched_log->opt.buffered) { if (sched_log->opt.buffered) {
sched_log->buf = cbuf_create(128, 8192); sched_log->buf = cbuf_create(128, 8192);
...@@ -410,7 +418,7 @@ int sched_log_init(char *prog, log_options_t opt, log_facility_t fac, char *logf ...@@ -410,7 +418,7 @@ int sched_log_init(char *prog, log_options_t opt, log_facility_t fac, char *logf
return rc; return rc;
} }
void log_fini() void log_fini(void)
{ {
if (!log) if (!log)
return; return;
......
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