According iptables sources for reusing iptables target optind must be reset to
zero, this is important in batch processing. Also if we are using iptables
target, we are allocating memory for two temporary variables and inside
structure of iptables_target, which must be freed when job done. Also
tflags and used in structure must be reset, to zero for next reuse of
structure.
Signed-off-by: Denys Fedoryshchenko <denys@visp.net.lb>
Tested-by: Denys Fedoryshchenko <denys@visp.net.lb>
---
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-05 21:39:49.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;
}
@@ -512,8 +518,15 @@
*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;
+ m->used=0;
+ /* Free allocated memory */
+ if (m->t)
+ free(m->t);
+
return 0;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html| Trent Piepho | [PATCH] [POWERPC] Improve (in|out)_beXX() asm code |
| Andi Kleen | [PATCH] [4/50] x86: add cpu codenames for Kconfig.cpu |
| Andi Kleen | [PATCH] [0/45] x86 2.6.24 patches review I |
| Stoyan Gaydarov | From 2.4 to 2.6 to 2.7? |
git: | |
| Jarek Poplawski | Re: HTB accuracy for high speed |
| David Miller | Re: [GIT]: Networking |
| Gerrit Renker | [PATCH 13/37] dccp: Deprecate Ack Ratio sysctl |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
