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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to