Skip to contentSkip to conversation

Fixed some memoryleaks in ip(6)tables.c

DISCUSSION Martin Josefsson 2 participants 3 messages May 18, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hi

I just committed a fix for 7 memoryleaks in iptables.c (ip6tables.c got the same treatment).

As always when messing with things that interact with libiptc you need to give people a heads up... this is it.

If it breaks you know who to blame :)

I converted an application from direct libiptc fiddling to use do_command() from iptables.c instead (why use the horrible lowlevel interface of libiptc when you don't have to?) and found some memoryleaks. These changes has been running in a small testprogram under valgrind and seems to work fine.

People with large iptables-restore "sessions" might notice a decrease in memory-usage.

Signature · 1 line
/Martin
#1 lore raw
Quoted 5 lines · Martin Josefsson

I converted an application from direct libiptc fiddling to use do_command() from iptables.c instead (why use the horrible lowlevel interface of libiptc when you don't have to?) and found some memoryleaks. These changes has been running in a small testprogram under valgrind and seems to work fine.

Then there is more good news for you. You can now easily complete the migration to not at all link the application directly to iptables by using a iptables-restore session. iptables-restore is essentially the same interface as do_command with only some nice syntactical sugar added.

Quoted 2 lines

People with large iptables-restore "sessions" might notice a decrease in memory-usage.

Thanks!

Regards
Henrik

#2 lore raw
Quoted 8 lines · Henrik Nordstrom
Quoted 5 lines · Martin Josefsson

I converted an application from direct libiptc fiddling to use do_command() from iptables.c instead (why use the horrible lowlevel interface of libiptc when you don't have to?) and found some memoryleaks. These changes has been running in a small testprogram under valgrind and seems to work fine.

Quoted 4 lines

Then there is more good news for you. You can now easily complete the migration to not at all link the application directly to iptables by using a iptables-restore session. iptables-restore is essentially the same interface as do_command with only some nice syntactical sugar added.

Heh, I know, iptables-restore accepts all commands iptables does. I use that heavily in a rule-management script I made to sync the rules in kernel to match the configfiles in a single atomic update.
I should document it and post it some day, it's very simple but so nice to have.

I link it since that's what this application did earlier, don't want to rewrite the world, just clean it up a bit :)

Quoted 4 lines
Quoted 2 lines

People with large iptables-restore "sessions" might notice a decrease in memory-usage.

Thanks!

Let me know if you see any leaks, crashes or slowdowns. I don't have any really large setups to play with.

Signature · 1 line
/Martin