svn commit: r302845 - head/usr.bin/mail

Pedro F. Giffuni pfg at FreeBSD.org
Thu Jul 14 15:09:10 UTC 2016


Author: pfg
Date: Thu Jul 14 15:09:08 2016
New Revision: 302845
URL: https://svnweb.freebsd.org/changeset/base/302845

Log:
  mail(1): check for out of memory conditions when calling calloc(3).
  
  X-MFC with:	r302771

Modified:
  head/usr.bin/mail/vars.c

Modified: head/usr.bin/mail/vars.c
==============================================================================
--- head/usr.bin/mail/vars.c	Thu Jul 14 14:48:40 2016	(r302844)
+++ head/usr.bin/mail/vars.c	Thu Jul 14 15:09:08 2016	(r302845)
@@ -56,7 +56,8 @@ assign(const char *name, const char *val
 	h = hash(name);
 	vp = lookup(name);
 	if (vp == NULL) {
-		vp = calloc(1, sizeof(*vp));
+		if ((vp = calloc(1, sizeof(*vp))) == NULL)
+			err(1, "Out of memory");
 		vp->v_name = vcopy(name);
 		vp->v_link = variables[h];
 		variables[h] = vp;


More information about the svn-src-head mailing list