summaryrefslogtreecommitdiffstats
path: root/src/net/udp/dhcp.c
diff options
context:
space:
mode:
authorMichael Brown2006-07-20 04:25:39 +0200
committerMichael Brown2006-07-20 04:25:39 +0200
commit6a0b4c9772c8034995de68212811f420e949a2cc (patch)
tree1e2736d0addab704f786efc678d9253dba39a083 /src/net/udp/dhcp.c
parentDocument memory ownership. (diff)
downloadipxe-6a0b4c9772c8034995de68212811f420e949a2cc.tar.gz
ipxe-6a0b4c9772c8034995de68212811f420e949a2cc.tar.xz
ipxe-6a0b4c9772c8034995de68212811f420e949a2cc.zip
Free up any allocated options if we fail
Diffstat (limited to 'src/net/udp/dhcp.c')
-rw-r--r--src/net/udp/dhcp.c8
1 files changed, 8 insertions, 0 deletions
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 );
}