All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs-utils: Fix memory leak on error in nfs-server-generator
@ 2019-08-01 10:59 Alice J Mitchell
  2019-08-01 16:20 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Alice J Mitchell @ 2019-08-01 10:59 UTC (permalink / raw)
  To: linux-nfs; +Cc: Steve Dickson

Fix the trivial memory leak in the error handling of nfs-server-generator

Signed-off-by: Alice J Mitchell <ajmitchell@redhat.com>
---
 systemd/nfs-server-generator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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) +
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nfs-utils: Fix memory leak on error in nfs-server-generator
  2019-08-01 10:59 [PATCH] nfs-utils: Fix memory leak on error in nfs-server-generator Alice J Mitchell
@ 2019-08-01 16:20 ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2019-08-01 16:20 UTC (permalink / raw)
  To: Alice J Mitchell, linux-nfs



On 8/1/19 6:59 AM, Alice J Mitchell wrote:
> Fix the trivial memory leak in the error handling of nfs-server-generator
> 
> Signed-off-by: Alice J Mitchell <ajmitchell@redhat.com>
Committed... 

steved.
> ---
>  systemd/nfs-server-generator.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> 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) +
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-01 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-01 10:59 [PATCH] nfs-utils: Fix memory leak on error in nfs-server-generator Alice J Mitchell
2019-08-01 16:20 ` Steve Dickson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.