Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Dec 2015 17:52:09 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292443 - head/usr.sbin/boot0cfg
Message-ID:  <201512181752.tBIHq9QN069909@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Dec 18 17:52:08 2015
New Revision: 292443
URL: https://svnweb.freebsd.org/changeset/base/292443

Log:
  Fix the precious change to check the pointer returned by malloc().
  
  Submitted by:	luke <luke.tw@gmail.com>
  Pointy hat to:	jhb

Modified:
  head/usr.sbin/boot0cfg/boot0cfg.c

Modified: head/usr.sbin/boot0cfg/boot0cfg.c
==============================================================================
--- head/usr.sbin/boot0cfg/boot0cfg.c	Fri Dec 18 17:39:54 2015	(r292442)
+++ head/usr.sbin/boot0cfg/boot0cfg.c	Fri Dec 18 17:52:08 2015	(r292443)
@@ -337,7 +337,7 @@ read_mbr(const char *disk, u_int8_t **mb
 	return (mbr_size);
     }
     *mbr = malloc(sizeof(buf));
-    if (mbr == NULL)
+    if (*mbr == NULL)
 	errx(1, "%s: unable to allocate MBR buffer", disk);
     memcpy(*mbr, buf, sizeof(buf));
     close(fd);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512181752.tBIHq9QN069909>