aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGabriel Ganne <gabriel.ganne@gmail.com>2022-05-05 10:16:56 +0200
committerDamjan Marion <dmarion@me.com>2022-05-08 14:00:11 +0000
commit01f6c7353084d1180387ae64b936e96028e17fbd (patch)
treea340da4cb6bb60b5fc5a9f01d6b93f9f325432fa /src
parentda052b62bd2158944342735ae4cfdc65de268d6b (diff)
devices: fix crash on invalid interface
Type: fix A simple "create host-interface name xxx" is enough to trigger the bug: The interface is not found, and we goto error with apif=NULL Signed-off-by: Gabriel Ganne <gabriel.ganne@gmail.com> Change-Id: I2f894176d39b3d15efab054dc7340e7a0600a2e8
Diffstat (limited to 'src')
-rw-r--r--src/vnet/devices/af_packet/af_packet.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index 10b0ff2fb1a..83c10684c9f 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -679,8 +679,11 @@ error:
fd2 = -1;
}
vec_free (host_if_name_dup);
- memset (apif, 0, sizeof (*apif));
- pool_put (apm->interfaces, apif);
+ if (apif)
+ {
+ memset (apif, 0, sizeof (*apif));
+ pool_put (apm->interfaces, apif);
+ }
return ret;
}