aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librc/librc-daemon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 190a0146..02aff5a9 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -556,8 +556,8 @@ rc_service_daemons_crashed(const char *service)
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 = xmalloc(strlen(ch_root) + strlen(pidfile) + 1);
strcpy(spidfile, ch_root);
strcat(spidfile, pidfile);
}