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