From: Daniel Wagner <[email protected]>
We did not check if nat->fw was valid before destroying it
and also forgot to get rit of the nat pointer as well.
Reported by coverity.
---
src/nat.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/nat.c b/src/nat.c
index 1604cc9..4d23550 100644
--- a/src/nat.c
+++ b/src/nat.c
@@ -121,8 +121,11 @@ int __connman_nat_enable(const char *name, const char
*address,
return enable_nat(nat);
err:
- if (nat)
- __connman_firewall_destroy(nat->fw);
+ if (nat) {
+ if (nat->fw)
+ __connman_firewall_destroy(nat->fw);
+ g_free(nat);
+ }
if (g_hash_table_size(nat_hash) == 0)
enable_ip_forward(false);
--
1.8.4.474.g128a96c
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman