Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Sep 2019 20:28:09 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352421 - head/stand/libsa
Message-ID:  <201909162028.x8GKS9jK064079@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Mon Sep 16 20:28:08 2019
New Revision: 352421
URL: https://svnweb.freebsd.org/changeset/base/352421

Log:
  loader: Malloc(0) should return NULL.
  
  We really should not allocate anything with size 0.

Modified:
  head/stand/libsa/zalloc_malloc.c

Modified: head/stand/libsa/zalloc_malloc.c
==============================================================================
--- head/stand/libsa/zalloc_malloc.c	Mon Sep 16 20:26:53 2019	(r352420)
+++ head/stand/libsa/zalloc_malloc.c	Mon Sep 16 20:28:08 2019	(r352421)
@@ -55,6 +55,9 @@ Malloc(size_t bytes, const char *file, int line)
 {
     Guard *res;
 
+    if (bytes == 0)
+	return (NULL);
+
 #ifdef USEENDGUARD
     bytes += MALLOCALIGN + 1;
 #else



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