Sun, 29 Dec 2019 12:52:56 +0100
fixes another leak in string replace function
src/string.c | file | annotate | diff | comparison | revisions |
--- a/src/string.c Sun Dec 29 11:30:39 2019 +0100 +++ b/src/string.c Sun Dec 29 12:52:56 2019 +0100 @@ -712,7 +712,10 @@ if (curbuf->len == ibuflen) { struct scstrreplace_ibuf *nextbuf = calloc(1, sizeof(struct scstrreplace_ibuf)); - if (!nextbuf) return sstrn(NULL, 0); + if (!nextbuf) { + scstrrepl_free_ibuf(firstbuf); + return sstrn(NULL, 0); + } nextbuf->buf = calloc(ibuflen, sizeof(size_t)); if (!nextbuf->buf) { free(nextbuf);