diff options
author | chleun.moon <chleun.moon@samsung.com> | 2017-09-27 19:22:29 +0900 |
---|---|---|
committer | chleun.moon <chleun.moon@samsung.com> | 2017-09-27 19:25:05 +0900 |
commit | 3d1ecd4dbe486eebf7c9dad6b49152b83b888302 (patch) | |
tree | 4f41c4b946b59986d1b0dcf69cf9ec6351afff37 | |
parent | 1612cee1b8ab5f7e2582ec9ef5b92a72d05048d4 (diff) | |
download | connman-3d1ecd4dbe486eebf7c9dad6b49152b83b888302.tar.gz connman-3d1ecd4dbe486eebf7c9dad6b49152b83b888302.tar.bz2 connman-3d1ecd4dbe486eebf7c9dad6b49152b83b888302.zip |
[CID-26975, 36747] Fix memory leak and dereference after null check
Change-Id: Ief1a868d989cb2cc78bb55980e3d8bee03a4a42b
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
-rw-r--r-- | vpn/plugins/ipsec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vpn/plugins/ipsec.c b/vpn/plugins/ipsec.c index 7a2675e0..fa9dc7af 100644 --- a/vpn/plugins/ipsec.c +++ b/vpn/plugins/ipsec.c @@ -714,7 +714,7 @@ static int ipsec_load_shared_psk(struct vpn_provider *provider) if (!provider) { connman_error("invalid provider"); - ret = -EINVAL; + return -EINVAL; } data = vpn_provider_get_string(provider, "IPsec.IKEData"); @@ -840,8 +840,10 @@ static int ipsec_load_key(struct vpn_provider *provider) return 0; sect = vici_create_section(NULL); - if (!sect) + if (!sect) { + g_free(data); return -ENOMEM; + } vici_add_kv(sect, "type", type, NULL); vici_add_kv(sect, "data", data, NULL); |