From cad09ed1ccc789f9b3a9d0804394f42bcccba674 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 16 May 2020 14:51:05 +0000 Subject: Simpler error management in el_substitute --- src/libexecline/el_substitute.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/libexecline') diff --git a/src/libexecline/el_substitute.c b/src/libexecline/el_substitute.c index 9a337fe..daaa7d7 100644 --- a/src/libexecline/el_substitute.c +++ b/src/libexecline/el_substitute.c @@ -148,7 +148,6 @@ int el_substitute (stralloc *dst, char const *src, size_t len, char const *vars, { subsuinfo_t info = SUBSUINFO_ZERO ; size_t i = 0 ; - size_t dstbase = dst->len ; int nc = 0 ; int wasnull = !dst->s ; @@ -179,7 +178,6 @@ int el_substitute (stralloc *dst, char const *src, size_t len, char const *vars, err : genalloc_free(elsubsu_t, &info.list) ; stralloc_free(&info.sa) ; - if (wasnull) stralloc_free(&info.dst) ; else info.dst.len = dstbase ; - *dst = info.dst ; + stralloc_free(&info.dst) ; return -1 ; } -- cgit v1.2.3