summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2022-02-15 20:23:49 +0100
committerSander Vrijders <[email protected]>2022-02-17 08:28:49 +0100
commit6d87e29bef2d2cd3c40e49b9120fae5148030381 (patch)
tree73cdabd7e5439af9e44c14851fd6e6d492650f70 /src/ipcpd/unicast
parent80f6513802c56480582c8b5baa2168b9e5268aaa (diff)
downloadouroboros-6d87e29bef2d2cd3c40e49b9120fae5148030381.tar.gz
ouroboros-6d87e29bef2d2cd3c40e49b9120fae5148030381.zip
ipcpd: Fix free in fail path of readdir
The free of the buffer in the failure path of the readdir RIB functions was taking the wrong pointer in a couple of places. The FRCT RIB readdir was missing error handling for malloc and strdup. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd/unicast')
-rw-r--r--src/ipcpd/unicast/dt.c2
-rw-r--r--src/ipcpd/unicast/fa.c2
-rw-r--r--src/ipcpd/unicast/routing/link-state.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/ipcpd/unicast/dt.c b/src/ipcpd/unicast/dt.c
index 0f504daa..f2013809 100644
--- a/src/ipcpd/unicast/dt.c
+++ b/src/ipcpd/unicast/dt.c
@@ -312,7 +312,7 @@ static int dt_rib_readdir(char *** buf)
if ((*buf)[idx] == NULL) {
while (idx-- > 0)
free((*buf)[idx]);
- free(buf);
+ free(*buf);
pthread_mutex_unlock(&dt.stat[i].lock);
pthread_rwlock_unlock(&dt.lock);
return -ENOMEM;
diff --git a/src/ipcpd/unicast/fa.c b/src/ipcpd/unicast/fa.c
index 6e6d52f0..5edf77aa 100644
--- a/src/ipcpd/unicast/fa.c
+++ b/src/ipcpd/unicast/fa.c
@@ -238,7 +238,7 @@ static int fa_rib_readdir(char *** buf)
if ((*buf)[idx] == NULL) {
while (idx-- > 0)
free((*buf)[idx]);
- free(buf);
+ free(*buf);
pthread_rwlock_unlock(&fa.flows_lock);
return -ENOMEM;
}
diff --git a/src/ipcpd/unicast/routing/link-state.c b/src/ipcpd/unicast/routing/link-state.c
index 7ceb86a1..d6ecee99 100644
--- a/src/ipcpd/unicast/routing/link-state.c
+++ b/src/ipcpd/unicast/routing/link-state.c
@@ -273,7 +273,7 @@ static int lsdb_rib_readdir(char *** buf)
if ((*buf)[idx] == NULL) {
while (idx-- > 0)
free((*buf)[idx]);
- free(buf);
+ free(*buf);
pthread_rwlock_unlock(&ls.db_lock);
return -ENOMEM;
}