diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2017-02-04 09:12:47 +0000 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2017-02-04 09:12:47 +0000 |
commit | e3b1288354349edc53c7c3c9ebd3efe23a7df10d (patch) | |
tree | 3a47f2b2db895173a1e3605df3fbdc925b7b127b /src/ipcpd/shim-eth-llc/main.c | |
parent | c677d8a88065e6bc8e071f3f03a440e4ed083abb (diff) | |
parent | a30e244407655d16429ef442ac23db43a548bf95 (diff) | |
download | ouroboros-e3b1288354349edc53c7c3c9ebd3efe23a7df10d.tar.gz ouroboros-e3b1288354349edc53c7c3c9ebd3efe23a7df10d.zip |
Merged in dstaesse/ouroboros/be-wip (pull request #359)
irmd: Fix memleak in registry
Diffstat (limited to 'src/ipcpd/shim-eth-llc/main.c')
-rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index c59a8054..bc0d8a27 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -865,11 +865,18 @@ static int eth_llc_ipcp_bootstrap(struct dif_config * conf) static int eth_llc_ipcp_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_ERR("Failed to add %s to local registry.", name); + free(name_dup); return -1; } |