smpp_smsc: use osmo_talloc_replace_string() in smpp_smsc_conf()
Change-Id: Ie3dc0d9673a0410a5908cba77fc352d581bac6f6 Fixes: CID#240711
This commit is contained in:
parent
97b8e76b50
commit
e0661105ac
|
@ -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 */
|
/* Avoid use-after-free if bind_addr == smsc->bind_addr */
|
||||||
if (smsc->bind_addr == bind_addr)
|
if (smsc->bind_addr == bind_addr)
|
||||||
return 0;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue