summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhsandid <halsandi@cisco.com>2024-01-24 13:58:03 +0100
committerBeno�t Ganne <bganne@cisco.com>2024-02-12 16:29:22 +0000
commitd1fa7ae03e439f01bb37140bf84c06e6d78217e7 (patch)
tree695a707ac6f738fbebfc1dbf549cd02bfe139b55
parent04fd51c03c428859bae949a8294ee0f9c062a44b (diff)
af_packet : fix crash on interface creation
Type: fix Attempting to create a host-interface with an invalid af_packet name causes a crash, as we attempt to read the contents of a null ptr. Change-Id: Ia31ae21684c2b66baa1ceaadf29e19fae33c4ed4 Signed-off-by: hsandid <halsandi@cisco.com>
-rw-r--r--src/plugins/af_packet/af_packet.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/af_packet/af_packet.c b/src/plugins/af_packet/af_packet.c
index 7ff30e0a722..69245429918 100644
--- a/src/plugins/af_packet/af_packet.c
+++ b/src/plugins/af_packet/af_packet.c
@@ -821,13 +821,15 @@ error:
close (fd2);
fd2 = -1;
}
- vec_foreach_index (i, apif->fds)
- if (apif->fds[i] != -1)
- close (apif->fds[i]);
- vec_free (apif->fds);
+
vec_free (host_if_name_dup);
+
if (apif)
{
+ vec_foreach_index (i, apif->fds)
+ if (apif->fds[i] != -1)
+ close (apif->fds[i]);
+ vec_free (apif->fds);
memset (apif, 0, sizeof (*apif));
pool_put (apm->interfaces, apif);
}