summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/main.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-01-29 13:17:33 +0100
committerdimitri staessens <[email protected]>2017-01-29 13:23:38 +0100
commit1f94baea43c031c366decb9c772514a89a7fa372 (patch)
tree14c3f3aa49f62706d5bcf7cd5e87698956a9a599 /src/ipcpd/normal/main.c
parentcfc1e421cd222f41dd1c8498d631a31c680e4211 (diff)
downloadouroboros-1f94baea43c031c366decb9c772514a89a7fa372.tar.gz
ouroboros-1f94baea43c031c366decb9c772514a89a7fa372.zip
ipcpd: Don't strdup() the dif_name in main loop
Diffstat (limited to 'src/ipcpd/normal/main.c')
-rw-r--r--src/ipcpd/normal/main.c9
1 files changed, 7 insertions, 2 deletions
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);