commit:     3a803b3135837665d51ef4dd7a8b913c78e71ff6
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Jun 27 17:06:19 2018 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Jun 27 17:06:19 2018 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=3a803b31

librc-daemon.c: fix memory leaks

 src/librc/librc-daemon.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 173fcb83..6f3b492f 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -422,6 +422,7 @@ rc_service_daemon_set(const char *service, const char *exec,
                                rename(file, oldfile);
                                strlcpy(oldfile, file, sizeof(oldfile));
                        }
+                       free(file);
                }
                closedir(dp);
                rc_stringlist_free(match);
@@ -446,10 +447,12 @@ rc_service_daemon_set(const char *service, const char 
*exec,
                                fclose(fp);
                                retval = true;
                        }
+                       free(file);
                }
        } else
                retval = true;
 
+       free(dirpath);
        return retval;
 }
 librc_hidden_def(rc_service_daemon_set)

Reply via email to