diff --git a/src/libmsc/smpp_smsc.c b/src/libmsc/smpp_smsc.c index 34b93f88f..d07165b09 100644 --- a/src/libmsc/smpp_smsc.c +++ b/src/libmsc/smpp_smsc.c @@ -971,10 +971,12 @@ struct smsc *smpp_smsc_alloc_init(void *ctx) /*! \brief Set the SMPP address and port without binding. */ int smpp_smsc_conf(struct smsc *smsc, const char *bind_addr, uint16_t port) { + const char *tmpaddr = bind_addr ? talloc_strdup(smsc, bind_addr) : NULL; + talloc_free((void*)smsc->bind_addr); smsc->bind_addr = NULL; if (bind_addr) { - smsc->bind_addr = talloc_strdup(smsc, bind_addr); + smsc->bind_addr = tmpaddr; if (!smsc->bind_addr) return -ENOMEM; }