All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denys Fedoryshchenko <denys@visp.net.lb>
To: hadi@cyberus.ca
Cc: Stephen Hemminger <shemminger@linux-foundation.org>,
	netdev@vger.kernel.org
Subject: Re: few more fixes for iproute2/m_ipt
Date: Wed, 6 Aug 2008 15:50:41 +0300	[thread overview]
Message-ID: <200808061550.42003.denys@visp.net.lb> (raw)
In-Reply-To: <1218026760.4755.60.camel@localhost>

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

On Wednesday 06 August 2008, jamal wrote:
> cheers,
> jamal
> PS:- dont wanna sound anal - and you dont have to do this if you dont
> have time; but if you put the resetting of optind and the flags in a
> separate patch from the freeing, that would be even better.
Yes, i did already
Attaching patches



[-- Attachment #2: 01-iproute-memleak_fix.patch --]
[-- Type: text/x-diff, Size: 832 bytes --]

diff -Naur iproute2-original/tc/m_ipt.c iproute2-patched/tc/m_ipt.c
--- iproute2-original/tc/m_ipt.c	2008-08-05 19:15:56.000000000 +0000
+++ iproute2-patched/tc/m_ipt.c	2008-08-06 11:13:47.000000000 +0000
@@ -277,6 +277,8 @@
 		if (!handle) {
 			fputs(dlerror(), stderr);
 			printf("\n");
+			free(l_name);
+			free(new_name);
 			return NULL;
 		}
 	}
@@ -292,12 +294,16 @@
 					fputs(error, stderr);
 					fprintf(stderr, "\n");
 					dlclose(handle);
+					free(l_name);
+					free(new_name);
 					return NULL;
 				}
 			}
 		}
 	}
 
+	free(l_name);
+	free(new_name);
 	return m;
 }
 
@@ -514,6 +520,13 @@
 
 	optind = 1;
 	free_opts(opts);
+	/* Clear flags if target will be used again */
+        m->tflags=0;
+        m->used=0;
+	/* Free allocated memory */
+        if (m->t)
+            free(m->t);
+
 
 	return 0;
 

[-- Attachment #3: 02-iproute-optind_zero.patch --]
[-- Type: text/x-diff, Size: 390 bytes --]

diff -Naur iproute2-patched/tc/m_ipt.c iproute2-patched2/tc/m_ipt.c
--- iproute2-patched/tc/m_ipt.c	2008-08-06 11:13:47.000000000 +0000
+++ iproute2-patched2/tc/m_ipt.c	2008-08-06 11:14:58.000000000 +0000
@@ -518,7 +518,7 @@
 	*argc_p = rargc - iargc;
 	*argv_p = argv;
 
-	optind = 1;
+	optind = 0;
 	free_opts(opts);
 	/* Clear flags if target will be used again */
         m->tflags=0;

  reply	other threads:[~2008-08-06 12:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-05 21:42 few more fixes for iproute2/m_ipt Denys Fedoryshchenko
2008-08-06 10:04 ` jamal
2008-08-06 10:21   ` Denys Fedoryshchenko
2008-08-06 11:04     ` jamal
2008-08-06 11:26       ` Denys Fedoryshchenko
2008-08-06 12:46         ` jamal
2008-08-06 12:50           ` Denys Fedoryshchenko [this message]
2008-08-06 12:55             ` jamal
2008-08-06 12:56               ` Denys Fedoryshchenko
2008-08-06 12:59               ` Denys Fedoryshchenko
2008-08-06 13:17                 ` jamal
2009-01-07  3:43 ` Stephen Hemminger

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=200808061550.42003.denys@visp.net.lb \
    --to=denys@visp.net.lb \
    --cc=hadi@cyberus.ca \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    /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.