diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-09-19 10:47:57 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-19 10:47:57 +0900 |
commit | d811ba1897b723fd0146875201061e3603c16391 (patch) | |
tree | 23594d07bf59cdd03c9e979c09f720ad1fee9fb0 /utf8.c | |
parent | Merge branch 'jk/shortlog-ident-cleanup' (diff) | |
parent | wt-status: release strbuf after use in wt_longstatus_print_tracking() (diff) | |
download | tgif-d811ba1897b723fd0146875201061e3603c16391.tar.xz |
Merge branch 'rs/strbuf-leakfix'
Many leaks of strbuf have been fixed.
* rs/strbuf-leakfix: (34 commits)
wt-status: release strbuf after use in wt_longstatus_print_tracking()
wt-status: release strbuf after use in read_rebase_todolist()
vcs-svn: release strbuf after use in end_revision()
utf8: release strbuf on error return in strbuf_utf8_replace()
userdiff: release strbuf after use in userdiff_get_textconv()
transport-helper: release strbuf after use in process_connect_service()
sequencer: release strbuf after use in save_head()
shortlog: release strbuf after use in insert_one_record()
sha1_file: release strbuf on error return in index_path()
send-pack: release strbuf on error return in send_pack()
remote: release strbuf after use in set_url()
remote: release strbuf after use in migrate_file()
remote: release strbuf after use in read_remote_branches()
refs: release strbuf on error return in write_pseudoref()
notes: release strbuf after use in notes_copy_from_stdin()
merge: release strbuf after use in write_merge_heads()
merge: release strbuf after use in save_state()
mailinfo: release strbuf on error return in handle_boundary()
mailinfo: release strbuf after use in handle_from()
help: release strbuf on error return in exec_woman_emacs()
...
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); } |