From 1f94baea43c031c366decb9c772514a89a7fa372 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sun, 29 Jan 2017 13:17:33 +0100 Subject: ipcpd: Don't strdup() the dif_name in main loop --- src/ipcpd/normal/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/ipcpd/normal/main.c') diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 85f56ab0..c1bae0d6 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -218,6 +218,13 @@ static int normal_ipcp_bootstrap(struct dif_config * conf) return -1; /* -ENOTINIT */ } + ipcpi.data->dif_name = strdup(conf->dif_name); + if (ipcpi.data->dif_name == NULL) { + pthread_rwlock_unlock(&ipcpi.state_lock); + LOG_ERR("Failed to set DIF name."); + return -1; + } + if (ribmgr_init()) { LOG_ERR("Failed to initialise RIB manager."); pthread_rwlock_unlock(&ipcpi.state_lock); @@ -273,8 +280,6 @@ static int normal_ipcp_bootstrap(struct dif_config * conf) return -1; } - ipcpi.data->dif_name = conf->dif_name; - pthread_rwlock_unlock(&ipcpi.state_lock); LOG_DBG("Bootstrapped in DIF %s.", conf->dif_name); -- cgit v1.2.3