summaryrefslogtreecommitdiff
path: root/systemd
diff options
context:
space:
mode:
authorAlice J Mitchell <ajmitchell@redhat.com>2019-08-01 12:18:38 -0400
committerSteve Dickson <steved@redhat.com>2019-08-01 12:18:38 -0400
commit8d69d0abcfe31de27c081d243aca8dcaf421ba37 (patch)
tree5524fc01c76950ab5278cf33706c456b800bc452 /systemd
parentc917e4ba433594b2a80fc90bfcb449e6a32043a9 (diff)
downloadnfs-utils-8d69d0abcfe31de27c081d243aca8dcaf421ba37.tar.gz
nfs-server-generator: Fix memory leak on error in nfs-server-generator
Fix the trivial memory leak in the error handling of nfs-server-generator Signed-off-by: Alice J Mitchell <ajmitchell@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'systemd')
-rw-r--r--systemd/nfs-server-generator.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/systemd/nfs-server-generator.c b/systemd/nfs-server-generator.c
index 737f109..eec98fd 100644
--- a/systemd/nfs-server-generator.c
+++ b/systemd/nfs-server-generator.c
@@ -25,6 +25,7 @@
#include <ctype.h>
#include <stdio.h>
#include <mntent.h>
+#include <alloca.h>
#include "misc.h"
#include "nfslib.h"
@@ -98,7 +99,7 @@ int main(int argc, char *argv[])
exit(1);
}
- path = malloc(strlen(argv[1]) + sizeof(dirbase) + sizeof(filebase));
+ path = alloca(strlen(argv[1]) + sizeof(dirbase) + sizeof(filebase));
if (!path)
exit(2);
if (export_read(_PATH_EXPORTS, 1) +