[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [PATCH libdmraid-events 3/3] Fix minor memory leak in lib_main



As lib_argv[3] is set to NULL, there is no point mallocing
some space an putting it there.

Signed-off-by: NeilBrown <neilb suse de>
---
 libdmraid-events.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- libdmraid-events.orig/libdmraid-events.c
+++ libdmraid-events/libdmraid-events.c
@@ -209,7 +209,7 @@ static int lib_main(char op, const char*
     int lib_argc=3;
     char *lib_argv[4];
     
-    for(i=0; i<4; i++)
+    for(i=0; i<3; i++)
 		lib_argv[i]=malloc(strlen(device) + 1);
     
     strcpy(lib_argv[0], "dso");
@@ -229,7 +229,7 @@ static int lib_main(char op, const char*
 	libdmraid_exit(lc);
     }
 
-    for(i=0; i<4; i++)
+    for(i=0; i<3; i++)
 		free(lib_argv[i]);        
 
     return ret;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]