All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: dm-devel@redhat.com
Subject: [PATCH libdmraid-events 3/3] Fix minor memory leak in lib_main
Date: Fri, 11 Dec 2009 14:22:58 +1100	[thread overview]
Message-ID: <20091211032413.811950494@suse.de> (raw)
In-Reply-To: 20091211032255.766079509@suse.de

[-- Attachment #1: memory-leak --]
[-- Type: text/plain, Size: 735 bytes --]

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;

  parent reply	other threads:[~2009-12-11  3:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11  3:22 [PATCH libdmraid-events 0/3] Assorted fixes NeilBrown
2009-12-11  3:22 ` [PATCH libdmraid-events 1/3] Add some missing closedir calls NeilBrown
2009-12-11  3:22 ` [PATCH libdmraid-events 2/3] Fix some issues with use of snprintf NeilBrown
2009-12-11  3:22 ` NeilBrown [this message]
2009-12-14 14:28 ` [PATCH libdmraid-events 0/3] Assorted fixes Heinz Mauelshagen
2009-12-15  0:43   ` Neil Brown
2009-12-15  1:07   ` Neil Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091211032413.811950494@suse.de \
    --to=neilb@suse.de \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.