Skip to content

Commit

Permalink
net/pxe: fix error condition
Browse files Browse the repository at this point in the history
Test return value of grub_netbuff_reserve(), buf itself cannot be
NULL here.

Found by: Coverity scan.
  • Loading branch information
arvidjaar committed Jan 30, 2015
1 parent 7aaed66 commit 12abe75
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions grub-core/net/drivers/i386/pc/pxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ grub_pxe_recv (struct grub_net_card *dev __attribute__ ((unused)))
return NULL;
/* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible
by 4. So that IP header is aligned on 4 bytes. */
grub_netbuff_reserve (buf, 2);
if (!buf)
if (grub_netbuff_reserve (buf, 2))
{
grub_netbuff_free (buf);
return NULL;
Expand Down

0 comments on commit 12abe75

Please sign in to comment.