diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-10-25 00:49:31 +0300 |
---|---|---|
committer | fixeria <vyanitskiy@sysmocom.de> | 2021-10-30 02:27:21 +0000 |
commit | e0661105aca655c2edf6bdbd52f2a4490ce877aa (patch) | |
tree | bb13f3971976805dc9cfc2e477fe34092a773218 /src | |
parent | 97b8e76b50a96a6f074ecba3748ff2bae481d86e (diff) |
smpp_smsc: use osmo_talloc_replace_string() in smpp_smsc_conf()
Change-Id: Ie3dc0d9673a0410a5908cba77fc352d581bac6f6
Fixes: CID#240711
Diffstat (limited to 'src')
-rw-r--r-- | src/libmsc/smpp_smsc.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/libmsc/smpp_smsc.c b/src/libmsc/smpp_smsc.c index a5c6165f0..4581865b9 100644 --- a/src/libmsc/smpp_smsc.c +++ b/src/libmsc/smpp_smsc.c @@ -987,14 +987,8 @@ int smpp_smsc_conf(struct smsc *smsc, const char *bind_addr, uint16_t port) /* Avoid use-after-free if bind_addr == smsc->bind_addr */ if (smsc->bind_addr == bind_addr) return 0; + osmo_talloc_replace_string(smsc, &smsc->bind_addr, bind_addr); - talloc_free((void*)smsc->bind_addr); - smsc->bind_addr = NULL; - if (bind_addr) { - smsc->bind_addr = bind_addr ? talloc_strdup(smsc, bind_addr) : NULL; - if (!smsc->bind_addr) - return -ENOMEM; - } return 0; } |