summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast/pol/multipath_pff.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2020-02-16 16:17:20 +0100
committerSander Vrijders <sander@ouroboros.rocks>2020-02-16 18:33:21 +0100
commita59b71095a84dcbd7c3684639acf3dd3097bd3f2 (patch)
tree639c6f216e141c163b240a9c7edd3fc9e276f303 /src/ipcpd/unicast/pol/multipath_pff.c
parentaf8e7f78af9b13c2cf6615dc9eb6c52c51b2bc2c (diff)
downloadouroboros-a59b71095a84dcbd7c3684639acf3dd3097bd3f2.tar.gz
ouroboros-a59b71095a84dcbd7c3684639acf3dd3097bd3f2.zip
ipcpd: Fix double free, memleak and malloc check
Some fixes in the multipath implementation related to memory management that showed up with the static analyzer. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/unicast/pol/multipath_pff.c')
-rw-r--r--src/ipcpd/unicast/pol/multipath_pff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ipcpd/unicast/pol/multipath_pff.c b/src/ipcpd/unicast/pol/multipath_pff.c
index 8f619006..0fe101bc 100644
--- a/src/ipcpd/unicast/pol/multipath_pff.c
+++ b/src/ipcpd/unicast/pol/multipath_pff.c
@@ -132,7 +132,7 @@ int multipath_pff_update(struct pff_i * pff_i,
assert(len > 0);
tmp = malloc(sizeof(*tmp));
- if (fds == NULL)
+ if (tmp == NULL)
return -ENOMEM;
memcpy(tmp,fds, len * sizeof(*tmp));
@@ -142,7 +142,7 @@ int multipath_pff_update(struct pff_i * pff_i,
return -1;
}
- if (pft_insert(pff_i->pft, addr, fds, 1)) {
+ if (pft_insert(pff_i->pft, addr, tmp, 1)) {
free(tmp);
return -1;
}