# HG changeset patch
# User Mike Becker <universe@uap-core.de>
# Date 1577620376 -3600
# Node ID 2c9a5aebaee1ba0cd9ca44c341b9f8a99ebdfc82
# Parent  477404eb380e2f83fab0a06529b93cc6a6ab0a03
fixes another leak in string replace function

diff -r 477404eb380e -r 2c9a5aebaee1 src/string.c
--- 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);