summaryrefslogtreecommitdiff
path: root/src/libexecline/el_substitute.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-05-16 14:51:05 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-05-16 14:51:05 +0000
commitcad09ed1ccc789f9b3a9d0804394f42bcccba674 (patch)
tree0f7b5d6585132c843908969c3964f5bf963c7be0 /src/libexecline/el_substitute.c
parent9b1f710b8e4ade81fd57da97c460257a9b98c953 (diff)
downloadexecline-cad09ed1ccc789f9b3a9d0804394f42bcccba674.tar.xz
Simpler error management in el_substitute
Diffstat (limited to 'src/libexecline/el_substitute.c')
-rw-r--r--src/libexecline/el_substitute.c4
1 files changed, 1 insertions, 3 deletions
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 ;
}