AmendHub

Download:

jcs

/

subtext

/

amendments

/

334

ansi: Cope with malloc failure


jcs made amendment 334 about 1 year ago
--- ansi.c Wed Feb 22 22:48:35 2023 +++ ansi.c Wed Mar 1 16:41:13 2023 @@ -232,8 +232,11 @@ ansi_strip(char *inp, char **outp) size_t n, olen = 0; short in_csi; - if (outp) - *outp = xmalloc(ilen + 1, "ansi_strip"); + if (outp) { + *outp = xmalloc(ilen + 1); + if (*outp == NULL) + return 0; + } for (n = 0, in_csi = 0; n < ilen; ) { if (in_csi) {