From 6a0b4c9772c8034995de68212811f420e949a2cc Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 20 Jul 2006 02:25:39 +0000 Subject: [PATCH] Free up any allocated options if we fail --- src/net/udp/dhcp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c index 466259ae..8ca09761 100644 --- a/src/net/udp/dhcp.c +++ b/src/net/udp/dhcp.c @@ -476,6 +476,14 @@ udp_to_dhcp ( struct udp_connection *conn ) { * @v rc Return status code */ static void dhcp_done ( struct dhcp_session *dhcp, int rc ) { + /* Free up options if we failed */ + if ( rc != 0 ) { + if ( dhcp->options ) { + free_dhcp_options ( dhcp->options ); + dhcp->options = NULL; + } + } + /* Mark async operation as complete */ async_done ( &dhcp->aop, rc ); }