summaryrefslogtreecommitdiff
path: root/netboot.c
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2013-09-24 12:05:34 -0400
committerPeter Jones <pjones@redhat.com>2013-09-24 12:05:34 -0400
commit6eaa1a9c9e322e7e0b7ef08181c3450655f32857 (patch)
tree24ecba2a7475b2db1d50457f99367fc8a20125b0 /netboot.c
parent3816832bc5117670426cf291fc01d6ba5bef83d7 (diff)
downloadefi-boot-shim-6eaa1a9c9e322e7e0b7ef08181c3450655f32857.tar.gz
efi-boot-shim-6eaa1a9c9e322e7e0b7ef08181c3450655f32857.zip
Misc allocation cleanups
Diffstat (limited to 'netboot.c')
-rw-r--r--netboot.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/netboot.c b/netboot.c
index e5433639..e7010e7a 100644
--- a/netboot.c
+++ b/netboot.c
@@ -159,10 +159,9 @@ static char *get_v6_bootfile_url(EFI_PXE_BASE_CODE_DHCPV6_PACKET *pkt)
if (ntohs(option->OpCode) == 59) {
/* This is the bootfile url option */
urllen = ntohs(option->Length);
- url = AllocatePool(urllen+2);
+ url = AllocateZeroPool(urllen+1);
if (!url)
return NULL;
- memset(url, 0, urllen+2);
memcpy(url, option->Data, urllen);
return url;
}
@@ -274,10 +273,13 @@ static EFI_STATUS parseDhcp6()
bootfile_url = get_v6_bootfile_url(packet);
- if (extract_tftp_info(bootfile_url) == FALSE)
- return EFI_NOT_FOUND;
if (!bootfile_url)
return EFI_NOT_FOUND;
+ if (extract_tftp_info(bootfile_url) == FALSE) {
+ FreePool(bootfile_url);
+ return EFI_NOT_FOUND;
+ }
+ FreePool(bootfile_url);
return EFI_SUCCESS;
}