From f6a842748d17234124c3790b8b4b7339f612e5c4 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Mon, 23 Feb 2009 13:44:04 -0800 Subject: 06-fix_libnet_pblock_coalesce_leak.patch from debian source package See http://packages.debian.org/source/sid/libnet --- libnet/src/libnet_pblock.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libnet/src/libnet_pblock.c b/libnet/src/libnet_pblock.c index 9da014f..ae12db9 100644 --- a/libnet/src/libnet_pblock.c +++ b/libnet/src/libnet_pblock.c @@ -339,7 +339,7 @@ libnet_pblock_coalesce(libnet_t *l, u_int8_t **packet, u_int32_t *size) snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): packet assembly cannot find a layer 2 header\n", __func__); - return (-1); + goto err; } break; case LIBNET_RAW4: @@ -348,7 +348,7 @@ libnet_pblock_coalesce(libnet_t *l, u_int8_t **packet, u_int32_t *size) snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): packet assembly cannot find an IPv4 header\n", __func__); - return (-1); + goto err; } break; case LIBNET_RAW6: @@ -357,7 +357,7 @@ libnet_pblock_coalesce(libnet_t *l, u_int8_t **packet, u_int32_t *size) snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): packet assembly cannot find an IPv6 header\n", __func__); - return (-1); + goto err; } break; default: @@ -365,7 +365,7 @@ libnet_pblock_coalesce(libnet_t *l, u_int8_t **packet, u_int32_t *size) snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): suddenly the dungeon collapses -- you die\n", __func__); - return (-1); + goto err; break; } } @@ -419,6 +419,10 @@ libnet_pblock_coalesce(libnet_t *l, u_int8_t **packet, u_int32_t *size) *size -= l->aligner; } return (1); + +err: + free(packet); + return (-1); } void -- cgit v1.2.1