diff options
author | dimitri staessens <[email protected]> | 2017-02-03 20:38:39 +0100 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-02-03 20:50:48 +0100 |
commit | a30e244407655d16429ef442ac23db43a548bf95 (patch) | |
tree | 3a47f2b2db895173a1e3605df3fbdc925b7b127b /src/ipcpd/local/main.c | |
parent | 29fe780c782b74f516a47521297848095a8f5ede (diff) | |
download | ouroboros-a30e244407655d16429ef442ac23db43a548bf95.tar.gz ouroboros-a30e244407655d16429ef442ac23db43a548bf95.zip |
ipcpd: Remove strdup() from ipcp main loop
Diffstat (limited to 'src/ipcpd/local/main.c')
-rw-r--r-- | src/ipcpd/local/main.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 73c22975..c2b22732 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -168,11 +168,18 @@ static int ipcp_local_bootstrap(struct dif_config * conf) static int ipcp_local_name_reg(char * name) { + char * name_dup = strdup(name); + if (name_dup == NULL) { + LOG_ERR("Failed to duplicate name."); + return -ENOMEM; + } + pthread_rwlock_rdlock(&ipcpi.state_lock); - if (ipcp_data_reg_add_entry(ipcpi.data, name)) { + if (ipcp_data_reg_add_entry(ipcpi.data, name_dup)) { pthread_rwlock_unlock(&ipcpi.state_lock); LOG_DBG("Failed to add %s to local registry.", name); + free(name_dup); return -1; } |