aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-11-20 18:06:01 +0100
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-11-20 18:06:01 +0100
commit275b80b81746cdf5fc9b8299e7441c9d0d8718de (patch)
tree7402451d28e79eefd36c0fd57ebff077ea868dda /ctrl
parent1d1c54db773d8b9f81f15295fe6ecea872ce2883 (diff)
[HICN-404] double-free in facemgr (facemgr_list_facelets_json) + valgrind fixes
Change-Id: Id57873d3f4152af654f3bc27778d7015495597d7 Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl')
-rw-r--r--ctrl/facemgr/src/api.c1
-rw-r--r--ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c3
-rw-r--r--ctrl/libhicnctrl/src/api.c4
3 files changed, 5 insertions, 3 deletions
diff --git a/ctrl/facemgr/src/api.c b/ctrl/facemgr/src/api.c
index dfb23db3b..13b811288 100644
--- a/ctrl/facemgr/src/api.c
+++ b/ctrl/facemgr/src/api.c
@@ -2087,7 +2087,6 @@ facemgr_list_facelets_json(const facemgr_t * facemgr, char ** buffer)
if (size != 0 && cur >= s + size)
goto END;
}
- free(facelet_array);
rc = snprintf(cur, s + size - cur, "]}\n");
if (rc < 0)
diff --git a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
index a6cd44fe0..4ba4c5b1f 100644
--- a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
+++ b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
@@ -101,7 +101,6 @@ int hl_process_state(interface_t * interface)
}
data->state = HL_STATE_FACES_SENT;
break;
- break;
case HL_STATE_FACES_RECEIVED:
data->state = HL_STATE_IDLE;
@@ -601,7 +600,7 @@ int hl_callback(interface_t * interface, int fd, void * unused)
facelet_set_event(facelet, FACELET_EVENT_GET);
interface_raise_event(interface, facelet);
}
-
+ hc_data_free(results);
hc_data_free(data->polled_routes);
data->polled_routes = NULL;
data->state = HL_STATE_FACES_RECEIVED;
diff --git a/ctrl/libhicnctrl/src/api.c b/ctrl/libhicnctrl/src/api.c
index 1a5bd8cee..2d8ee40f0 100644
--- a/ctrl/libhicnctrl/src/api.c
+++ b/ctrl/libhicnctrl/src/api.c
@@ -521,6 +521,8 @@ hc_sock_free(hc_sock_t * s)
} else {
for (unsigned i = 0; i < n; i++) {
hc_sock_request_t * request = request_array[i];
+ if (hc_sock_map_remove(s->map, request->seq, NULL) < 0)
+ ERROR("[hc_sock_process] Error removing request from map");
hc_sock_request_free(request);
}
free(request_array);
@@ -669,6 +671,8 @@ hc_sock_process(hc_sock_t * s, hc_data_t ** data)
if (s->remaining == 0) {
hc_data_set_complete(request->data);
*data = request->data;
+ if (hc_sock_map_remove(s->map, request->seq, NULL) < 0)
+ ERROR("[hc_sock_process] Error removing request from map");
hc_sock_request_free(request);
} else {
/* We only remember it if there is still data to parse */