From 63045a20691f6e5a5184b887b87aebabd86d68b6 Mon Sep 17 00:00:00 2001 From: the 34c3 gsm team <34c3-gsm@congress> Date: Thu, 28 Dec 2017 15:38:05 +0100 Subject: smpp_smsc.c: don't talloc_strdup NULL pointers --- src/libmsc/smpp_smsc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3