All of lore.kernel.org
 help / color / mirror / Atom feed
From: Devendra Naga <devendra.aaru@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>, netdev@vger.kernel.org
Cc: Devendra Naga <devendra.aaru@gmail.com>
Subject: [PATCH] bridge-utils: fix AF_LOCAL socket leaks
Date: Thu,  4 Apr 2013 17:06:26 +0530	[thread overview]
Message-ID: <1365075386-2363-1-git-send-email-devendra.aaru@gmail.com> (raw)

valgrind reported the following leak on fc18 system:

valgrind -v --leak-check=full --track-fds=yes ./brctl show

==27307==
==27307== FILE DESCRIPTORS: 4 open at exit.
==27307== Open AF_UNIX socket 3: <unknown>
==27307==    at 0x397B2F3617: socket (in /usr/lib64/libc-2.16.so)
==27307==    by 0x403CF7: br_init (libbridge_init.c:35)
==27307==    by 0x4010BF: main (brctl.c:63)

fix it by calling br_shutdown

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
 brctl/brctl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/brctl/brctl.c b/brctl/brctl.c
index 46ca352..16080a7 100644
--- a/brctl/brctl.c
+++ b/brctl/brctl.c
@@ -43,6 +43,7 @@ int main(int argc, char *const* argv)
 		{ .name = "version", .val = 'V' },
 		{ 0 }
 	};
+	int ret;
 
 	while ((f = getopt_long(argc, argv, "Vh", options, NULL)) != EOF) 
 		switch(f) {
@@ -79,7 +80,10 @@ int main(int argc, char *const* argv)
 		return 1;
 	}
 
-	return cmd->func(argc, argv);
+	ret = cmd->func(argc, argv);
+	br_shutdown();
+
+	return ret;
 
 help:
 	help();
-- 
1.8.1.4

                 reply	other threads:[~2013-04-04 11:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1365075386-2363-1-git-send-email-devendra.aaru@gmail.com \
    --to=devendra.aaru@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.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.