mirror of https://github.com/ipxe/ipxe.git
[slam] Fix resource leak on error path
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/58/merge
parent
8963193cda
commit
60561d0f3d
|
@ -266,7 +266,8 @@ static int slam_tx_nack ( struct slam_request *slam ) {
|
|||
if ( ! iobuf ) {
|
||||
DBGC ( slam, "SLAM %p could not allocate I/O buffer\n",
|
||||
slam );
|
||||
return -ENOMEM;
|
||||
rc = -ENOMEM;
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
/* Construct NACK. We always request only a single packet;
|
||||
|
@ -294,14 +295,19 @@ static int slam_tx_nack ( struct slam_request *slam ) {
|
|||
"0-%ld\n", slam, ( num_blocks - 1 ) );
|
||||
}
|
||||
if ( ( rc = slam_put_value ( slam, iobuf, first_block ) ) != 0 )
|
||||
return rc;
|
||||
goto err_put_value;
|
||||
if ( ( rc = slam_put_value ( slam, iobuf, num_blocks ) ) != 0 )
|
||||
return rc;
|
||||
goto err_put_value;
|
||||
nul = iob_put ( iobuf, 1 );
|
||||
*nul = 0;
|
||||
|
||||
/* Transmit packet */
|
||||
return xfer_deliver_iob ( &slam->socket, iobuf );
|
||||
return xfer_deliver_iob ( &slam->socket, iob_disown ( iobuf ) );
|
||||
|
||||
err_put_value:
|
||||
free_iob ( iobuf );
|
||||
err_alloc:
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue