Hi there,
In cyrus-imapd-2.4.10/master/master.c:add_service at line 1486 the variable
char *cmd should not be set to NULL at that point, because the syslog function
is going to log nothing at line 1534, right?
The line "cmd = NULL; /* avoid freeing it */" at 1486 should be simply moved
to line 1539, after the syslog call, I think. Patch attached. Bugzilla report
is here: https://bugzilla.cyrusimap.org/show_bug.cgi?id=3497
Kristóf
diff --git a/GIT/TEMP/cyrus-imapd-2.4.10-ori/master/master.c b/GIT/TEMP/cyrus-imapd-2.4.10/master/master.c
index 823be06..5038a0b 100644
--- a/GIT/TEMP/cyrus-imapd-2.4.10-ori/master/master.c
+++ b/GIT/TEMP/cyrus-imapd-2.4.10/master/master.c
@@ -1479,15 +1479,14 @@ void add_service(const char *name, struct entry *e, void *rock)
Services[i].listen = listen;
listen = NULL; /* avoid freeing it */
if (Services[i].proto) free(Services[i].proto);
Services[i].proto = proto;
proto = NULL; /* avoid freeing it */
Services[i].exec = tokenize(cmd);
- cmd = NULL; /* avoid freeing it */
if (!Services[i].exec) fatal("out of memory", EX_UNAVAILABLE);
/* is this service actually there? */
if (!verify_service_file(Services[i].exec)) {
char buf[1024];
snprintf(buf, sizeof(buf),
"cannot find executable for service '%s'", name);
@@ -1532,14 +1531,16 @@ void add_service(const char *name, struct entry *e, void *rock)
syslog(LOG_DEBUG, "%s: service '%s' (%s, %s:%s, %d, %d, %d)",
reconfig ? "reconfig" : "add",
Services[i].name, cmd,
Services[i].proto, Services[i].listen,
Services[i].desired_workers,
Services[i].max_workers,
(int) Services[i].maxfds);
+
+ cmd = NULL; /* avoid freeing it */
done:
free(cmd);
free(listen);
free(proto);
free(max);
return;