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

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

 



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

Signed-off-by: NeilBrown <neilb@xxxxxxx>
---
 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;

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux