diff options
author | Sander Vrijders <[email protected]> | 2017-03-24 10:59:06 +0000 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-03-24 10:59:06 +0000 |
commit | e7f439e31aa8cd972b567da8c0421faa1ca09e59 (patch) | |
tree | 7b6464b8cd76877b316ed99fbd166c7d4cb288ba /src | |
parent | d51b66d838f7d3235f869e3dc1b8e8f9fe8e1147 (diff) | |
parent | 2ee56ae4d3c90b77d77e9be8e5e00832256e50de (diff) | |
download | ouroboros-e7f439e31aa8cd972b567da8c0421faa1ca09e59.tar.gz ouroboros-e7f439e31aa8cd972b567da8c0421faa1ca09e59.zip |
Merged in sandervrijders/ouroboros/be-free (pull request #420)
ipcpd: normal: Fix bad free
Diffstat (limited to 'src')
-rw-r--r-- | src/ipcpd/normal/routing.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/ipcpd/normal/routing.c b/src/ipcpd/normal/routing.c index 3a72bf36..f8705991 100644 --- a/src/ipcpd/normal/routing.c +++ b/src/ipcpd/normal/routing.c @@ -28,6 +28,7 @@ #include <ouroboros/logs.h> #include <ouroboros/rib.h> #include <ouroboros/rqueue.h> +#include <ouroboros/utils.h> #include "routing.h" #include "ribmgr.h" @@ -65,25 +66,24 @@ struct { static void * calculate_pff(void * o) { struct routing_table ** table; - ssize_t i; - int j; + ssize_t n_table; (void) o; while (true) { - i = graph_routing_table(routing.graph, ipcpi.dt_addr, &table); - if (table != NULL) { - /* - * FIXME: Calculate address to fd here - * and fill in PFF - */ + n_table = graph_routing_table(routing.graph, + ipcpi.dt_addr, &table); + if (table == NULL) { + sleep(RECALC_TIME); + continue; } - for (j = 0; j < i; j++) { - free(table[j]); - } - free(table); + /* + * FIXME: Calculate address to fd here + * and fill in PFF + */ + freepp(struct routing_table, table, n_table); sleep(RECALC_TIME); } |