projects
/
framework
/
connectivity
/
connman.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9d448a9
)
iptables-test: Properly clean tables up
author
Samuel Ortiz
<sameo@linux.intel.com>
Fri, 29 Oct 2010 21:43:48 +0000
(23:43 +0200)
committer
Samuel Ortiz
<sameo@linux.intel.com>
Fri, 29 Oct 2010 22:22:21 +0000
(
00:22
+0200)
tools/iptables-test.c
patch
|
blob
|
history
diff --git
a/tools/iptables-test.c
b/tools/iptables-test.c
index
f6114b8
..
a979cba
100644
(file)
--- a/
tools/iptables-test.c
+++ b/
tools/iptables-test.c
@@
-722,7
+722,17
@@
static int connman_iptables_replace(struct connman_iptables *table,
static void connman_iptables_cleanup(struct connman_iptables *table)
{
static void connman_iptables_cleanup(struct connman_iptables *table)
{
+ GList *list;
+ struct connman_iptables_entry *entry;
+
close(table->ipt_sock);
close(table->ipt_sock);
+
+ for (list = table->entries; list; list = list->next) {
+ entry = list->data;
+
+ g_free(entry->entry);
+ }
+
g_free(table->info);
g_free(table->blob_entries);
g_free(table);
g_free(table->info);
g_free(table->blob_entries);
g_free(table);
@@
-741,7
+751,15
@@
static int connman_iptables_commit(struct connman_iptables *table)
static int add_entry(struct ipt_entry *entry, struct connman_iptables *table)
{
static int add_entry(struct ipt_entry *entry, struct connman_iptables *table)
{
- return connman_add_entry(table, entry, NULL);
+ struct ipt_entry *new_entry;
+
+ new_entry = g_try_malloc0(entry->next_offset);
+ if (new_entry == NULL)
+ return -ENOMEM;
+
+ memcpy(new_entry, entry, entry->next_offset);
+
+ return connman_add_entry(table, new_entry, NULL);
}
static struct connman_iptables *connman_iptables_init(const char *table_name)
}
static struct connman_iptables *connman_iptables_init(const char *table_name)