librc-daemon.c: fix memory leaks

This commit is contained in:
William Hubbs 2018-06-27 12:06:19 -05:00
parent 72df51e17b
commit 3a803b3135

View File

@ -422,6 +422,7 @@ rc_service_daemon_set(const char *service, const char *exec,
rename(file, oldfile); rename(file, oldfile);
strlcpy(oldfile, file, sizeof(oldfile)); strlcpy(oldfile, file, sizeof(oldfile));
} }
free(file);
} }
closedir(dp); closedir(dp);
rc_stringlist_free(match); rc_stringlist_free(match);
@ -446,10 +447,12 @@ rc_service_daemon_set(const char *service, const char *exec,
fclose(fp); fclose(fp);
retval = true; retval = true;
} }
free(file);
} }
} else } else
retval = true; retval = true;
free(dirpath);
return retval; return retval;
} }
librc_hidden_def(rc_service_daemon_set) librc_hidden_def(rc_service_daemon_set)