diff --git a/ggatessh/ggatessh.c b/ggatessh/ggatessh.c index dedeab8..06c766d 100644 --- a/ggatessh/ggatessh.c +++ b/ggatessh/ggatessh.c @@ -757,7 +757,9 @@ ggatessh_makepidfile(void) if (ggatessh_pidfile == NULL) { asprintf(&ggatessh_pidfile, _PATH_VARRUN "/ggatessh.ggate%d.pid", unit); - err(EXIT_FAILURE, "Cannot allocate memory for pidfile"); + if (ggatessh_pidfile == NULL) + err(EXIT_FAILURE, + "Cannot allocate memory for pidfile"); } pfh = pidfile_open(ggatessh_pidfile, 0600, &otherpid); if (pfh == NULL) {