diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-05-16 14:51:05 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-05-16 14:51:05 +0000 |
commit | cad09ed1ccc789f9b3a9d0804394f42bcccba674 (patch) | |
tree | 0f7b5d6585132c843908969c3964f5bf963c7be0 | |
parent | 9b1f710b8e4ade81fd57da97c460257a9b98c953 (diff) | |
download | execline-cad09ed1ccc789f9b3a9d0804394f42bcccba674.tar.gz execline-cad09ed1ccc789f9b3a9d0804394f42bcccba674.tar.xz execline-cad09ed1ccc789f9b3a9d0804394f42bcccba674.zip |
Simpler error management in el_substitute
-rw-r--r-- | src/libexecline/el_substitute.c | 4 |
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 ; } |