From 772747e2ee644597026aa05de16f9ef9a50215b3 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Wed, 25 Feb 2015 09:57:05 +0000 Subject: [PATCH] Fix potential NULL dereference. Submitted by: Dmitry Luhtionov MFC after: 2 weeks --- sys/boot/fdt/fdt_loader_cmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/boot/fdt/fdt_loader_cmd.c b/sys/boot/fdt/fdt_loader_cmd.c index aff22306fd73..0ce8f153a80a 100644 --- a/sys/boot/fdt/fdt_loader_cmd.c +++ b/sys/boot/fdt/fdt_loader_cmd.c @@ -1299,13 +1299,12 @@ fdt_merge_strings(int argc, char *argv[], int start, char **buffer) sz += argc - start; buf = (char *)malloc(sizeof(char) * sz); - bzero(buf, sizeof(char) * sz); - if (buf == NULL) { sprintf(command_errbuf, "could not allocate space " "for string"); return (1); } + bzero(buf, sizeof(char) * sz); idx = 0; for (i = start, idx = 0; i < argc; i++) {