--- src/librc/librc-daemon.c.old 2014-10-29 23:07:55.715091991 +0300 +++ src/librc/librc-daemon.c 2014-10-29 23:08:05.424913928 +0300 @@ -556,8 +556,8 @@ char *ch_root = rc_service_value_get(basename_c(service), "chroot"); char *spidfile = pidfile; - if (ch_root) { - spidfile = malloc(strlen(ch_root) + strlen(pidfile)); + if (ch_root && pidfile) { + spidfile = malloc(strlen(ch_root) + strlen(pidfile) + 1); strcpy(spidfile, ch_root); strcat(spidfile, pidfile); }