nfs-utils: Fix memory leak on error in nfs-server-generator
Subsystems (2)
PATCH 1/1 nfs-utils: 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 <[email protected]>
--- systemd/nfs-server-generator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
systemd/nfs-server-generator.c +2 -1
@@ -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) +
Signature · 1 line
1.8.3.1
Quoted 3 lines · Alice J Mitchell
Fix the trivial memory leak in the error handling of nfs-server-generator
Signed-off-by Alice J Mitchell <[email protected]>
Committed...
steved.
Quoted 26 lines
--- systemd/nfs-server-generator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)systemd/nfs-server-generator.c +2
-1@@ -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) +