fix double free of pidfile
This fixes a double free of the pidfile variable. For discussion of this issue, see the bug. X-Gentoo-Bug: 531600 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=531600
This commit is contained in:
parent
6a9679377f
commit
74478830a8
@ -560,22 +560,20 @@ rc_service_daemons_crashed(const char *service)
|
||||
spidfile = xmalloc(strlen(ch_root) + strlen(pidfile) + 1);
|
||||
strcpy(spidfile, ch_root);
|
||||
strcat(spidfile, pidfile);
|
||||
free(pidfile);
|
||||
pidfile = spidfile;
|
||||
}
|
||||
|
||||
pid = 0;
|
||||
if (spidfile) {
|
||||
if (pidfile) {
|
||||
retval = true;
|
||||
if ((fp = fopen(spidfile, "r"))) {
|
||||
if ((fp = fopen(pidfile, "r"))) {
|
||||
if (fscanf(fp, "%d", &pid) == 1)
|
||||
retval = false;
|
||||
fclose(fp);
|
||||
}
|
||||
free(spidfile);
|
||||
spidfile = NULL;
|
||||
if (ch_root) {
|
||||
free(pidfile);
|
||||
pidfile = NULL;
|
||||
}
|
||||
free(pidfile);
|
||||
pidfile = NULL;
|
||||
|
||||
/* We have the pid, so no need to match
|
||||
on exec or name */
|
||||
|
Loading…
Reference in New Issue
Block a user