mail(1): check for out of memory conditions when calling calloc(3).

X-MFC with:	r302771
This commit is contained in:
Pedro F. Giffuni 2016-07-14 15:09:08 +00:00
parent 4cefe96c6d
commit 20a50e9ca9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=302845

View File

@ -56,7 +56,8 @@ assign(const char *name, const char *value)
h = hash(name); h = hash(name);
vp = lookup(name); vp = lookup(name);
if (vp == NULL) { 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_name = vcopy(name);
vp->v_link = variables[h]; vp->v_link = variables[h];
variables[h] = vp; variables[h] = vp;