Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
utf8: release strbuf on error return in strbuf_utf8_replace()
author
Rene Scharfe
<l.s.r@web.de>
Wed, 30 Aug 2017 18:20:16 +0000
(20:20 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 6 Sep 2017 23:49:28 +0000
(08:49 +0900)
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
utf8.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
460c7eb
)
diff --git
a/utf8.c
b/utf8.c
index 0c8e011a58cae3c683851007ec81828ad8284471..47a42047c814fb5c1a933d75fe1b5ecf338dfda1 100644
(file)
--- a/
utf8.c
+++ b/
utf8.c
@@
-381,7
+381,7
@@
void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
old = src;
n = utf8_width((const char**)&src, NULL);
if (!src) /* broken utf-8, do nothing */
-
return
;
+
goto out
;
if (n && w >= pos && w < pos + width) {
if (subst) {
memcpy(dst, subst, subst_len);
@@
-397,6
+397,7
@@
void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
}
strbuf_setlen(&sb_dst, dst - sb_dst.buf);
strbuf_swap(sb_src, &sb_dst);
+out:
strbuf_release(&sb_dst);
}