summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-03-25 11:26:11 +0100
committerdimitri staessens <dimitri.staessens@ugent.be>2017-03-25 11:35:04 +0100
commit006da084997e7a27eac5f037356e269fedac00bb (patch)
tree8f46da795657fc2e461c61ec3f4180e32fd68151 /src
parent1cff549fb60c2e14706272371dd62a0e2acefed5 (diff)
downloadouroboros-006da084997e7a27eac5f037356e269fedac00bb.tar.gz
ouroboros-006da084997e7a27eac5f037356e269fedac00bb.zip
ipcpd: Register nb_notifiers before starting gam
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/normal/ribmgr.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c
index 2696026a..772269ae 100644
--- a/src/ipcpd/normal/ribmgr.c
+++ b/src/ipcpd/normal/ribmgr.c
@@ -168,6 +168,7 @@ static void * reader(void * o)
break;
case -EFAULT:
log_warn("Hash mismatch, not in sync.");
+ free(data);
break;
default:
log_warn("Error unpacking %s.", name);
@@ -194,6 +195,7 @@ static void * reader(void * o)
break;
case -EFAULT:
log_warn("Hash mismatch, not yet in sync.");
+ free(data);
break;
default:
log_warn("Error unpacking %s.", name);
@@ -223,7 +225,6 @@ static void * reader(void * o)
log_err("Failed to send CDAP reply.");
continue;
}
-
break;
case CDAP_START:
case CDAP_STOP:
@@ -343,18 +344,9 @@ int ribmgr_init(void)
return -1;
}
- ribmgr.gam = gam_create(pg, ribmgr.nbs, ribmgr.ae);
- if (ribmgr.gam == NULL) {
- log_err("Failed to create gam.");
- connmgr_ae_destroy(ribmgr.ae);
- nbs_destroy(ribmgr.nbs);
- return -1;
- }
-
ribmgr.cdap = cdap_create();
if (ribmgr.cdap == NULL) {
log_err("Failed to create CDAP instance.");
- gam_destroy(ribmgr.gam);
connmgr_ae_destroy(ribmgr.ae);
nbs_destroy(ribmgr.nbs);
return -1;
@@ -364,7 +356,16 @@ int ribmgr_init(void)
if (nbs_reg_notifier(ribmgr.nbs, &ribmgr.nb_notifier)) {
log_err("Failed to register notifier.");
cdap_destroy(ribmgr.cdap);
- gam_destroy(ribmgr.gam);
+ connmgr_ae_destroy(ribmgr.ae);
+ nbs_destroy(ribmgr.nbs);
+ return -1;
+ }
+
+ ribmgr.gam = gam_create(pg, ribmgr.nbs, ribmgr.ae);
+ if (ribmgr.gam == NULL) {
+ log_err("Failed to create gam.");
+ nbs_unreg_notifier(ribmgr.nbs, &ribmgr.nb_notifier);
+ cdap_destroy(ribmgr.cdap);
connmgr_ae_destroy(ribmgr.ae);
nbs_destroy(ribmgr.nbs);
return -1;