msort: check realloc

pull/2/head
Christian Neukirchen 8 years ago
parent 795b756e5a
commit eb09650bba

@ -234,6 +234,8 @@ add(char *file)
if (mailalloc < 0) if (mailalloc < 0)
exit(-1); exit(-1);
mails = realloc(mails, sizeof (struct mail) * mailalloc); mails = realloc(mails, sizeof (struct mail) * mailalloc);
if (!mails)
exit(-1);
memset(mails+mailalloc/2, 0, sizeof (struct mail) * mailalloc/2); memset(mails+mailalloc/2, 0, sizeof (struct mail) * mailalloc/2);
} }
if (!mails) if (!mails)

Loading…
Cancel
Save