summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2019-04-25 15:58:39 -0400
committerSteve Dickson <steved@redhat.com>2019-04-25 15:58:39 -0400
commitb786080c45bdd550af9f2d894fc84bde41292440 (patch)
treea952d02989a1c2255030725967c65416ae9354f7
parentaf623a8ebfe8448a8a8982cd70c5d59c03db999d (diff)
downloadnfs-utils-b786080c45bdd550af9f2d894fc84bde41292440.tar.gz
Removed resource leaks from systemd/rpc-pipefs-generator.c
systemd/rpc-pipefs-generator.c:73: leaked_storage: Variable "pipefs_unit" going out of scope leaks the storage it points to systemd/rpc-pipefs-generator.c:77: leaked_storage: Variable "pipefs_unit" going out of scope leaks the storage it points to. systemd/rpc-pipefs-generator.c:85: leaked_storage: Variable "pipefs_unit" going out of scope leaks the storage it points to. systemd/rpc-pipefs-generator.c:94: leaked_storage: Variable "pipefs_unit" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--systemd/rpc-pipefs-generator.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c
index 0b5da11..8e218aa 100644
--- a/systemd/rpc-pipefs-generator.c
+++ b/systemd/rpc-pipefs-generator.c
@@ -69,12 +69,16 @@ int generate_target(char *pipefs_path, const char *dirname)
return 1;
ret = generate_mount_unit(pipefs_path, pipefs_unit, dirname);
- if (ret)
+ if (ret) {
+ free(pipefs_unit);
return ret;
+ }
path = malloc(strlen(dirname) + 1 + sizeof(filebase));
- if (!path)
+ if (!path) {
+ free(pipefs_unit);
return 2;
+ }
sprintf(path, "%s", dirname);
mkdir(path, 0755);
strcat(path, filebase);
@@ -82,6 +86,7 @@ int generate_target(char *pipefs_path, const char *dirname)
if (!f)
{
free(path);
+ free(pipefs_unit);
return 1;
}
@@ -90,6 +95,7 @@ int generate_target(char *pipefs_path, const char *dirname)
fprintf(f, "After=%s\n", pipefs_unit);
fclose(f);
free(path);
+ free(pipefs_unit);
return 0;
}