Author: mav
Date: Wed Feb 25 09:57:05 2015
New Revision: 279275
URL: https://svnweb.freebsd.org/changeset/base/279275

Log:
  Fix potential NULL dereference.
  
  Submitted by: Dmitry Luhtionov <[email protected]>
  MFC after:    2 weeks

Modified:
  head/sys/boot/fdt/fdt_loader_cmd.c

Modified: head/sys/boot/fdt/fdt_loader_cmd.c
==============================================================================
--- head/sys/boot/fdt/fdt_loader_cmd.c  Wed Feb 25 09:21:59 2015        
(r279274)
+++ head/sys/boot/fdt/fdt_loader_cmd.c  Wed Feb 25 09:57:05 2015        
(r279275)
@@ -1299,13 +1299,12 @@ fdt_merge_strings(int argc, char *argv[]
        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++) {
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to