From: Junio C Hamano Date: Wed, 29 May 2024 16:32:24 +0000 (-0700) Subject: Merge branch 'ps/leakfixes' into ps/no-writable-strings X-Git-Tag: v2.46.0-rc0~52^2~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5529cba09ff89b9762dbfd8f622e897948b60ab7;p=thirdparty%2Fgit.git Merge branch 'ps/leakfixes' into ps/no-writable-strings * ps/leakfixes: builtin/mv: fix leaks for submodule gitfile paths builtin/mv: refactor to use `struct strvec` builtin/mv duplicate string list memory builtin/mv: refactor `add_slash()` to always return allocated strings strvec: add functions to replace and remove strings submodule: fix leaking memory for submodule entries commit-reach: fix memory leak in `ahead_behind()` builtin/credential: clear credential before exit config: plug various memory leaks config: clarify memory ownership in `git_config_string()` builtin/log: stop using globals for format config builtin/log: stop using globals for log config convert: refactor code to clarify ownership of check_roundtrip_encoding diff: refactor code to clarify memory ownership of prefixes config: clarify memory ownership in `git_config_pathname()` http: refactor code to clarify memory ownership checkout: clarify memory ownership in `unique_tracking_name()` strbuf: fix leak when `appendwholeline()` fails with EOF transport-helper: fix leaking helper name --- 5529cba09ff89b9762dbfd8f622e897948b60ab7 diff --cc Makefile index 8f4432ae57,d4000fb1d6..dec283578a --- a/Makefile +++ b/Makefile @@@ -1334,11 -1334,11 +1334,12 @@@ THIRD_PARTY_SOURCES += compat/regex/ THIRD_PARTY_SOURCES += sha1collisiondetection/% THIRD_PARTY_SOURCES += sha1dc/% +UNIT_TEST_PROGRAMS += t-ctype UNIT_TEST_PROGRAMS += t-mem-pool +UNIT_TEST_PROGRAMS += t-prio-queue UNIT_TEST_PROGRAMS += t-strbuf + UNIT_TEST_PROGRAMS += t-strvec -UNIT_TEST_PROGRAMS += t-ctype -UNIT_TEST_PROGRAMS += t-prio-queue +UNIT_TEST_PROGRAMS += t-trailer UNIT_TEST_PROGS = $(patsubst %,$(UNIT_TEST_BIN)/%$X,$(UNIT_TEST_PROGRAMS)) UNIT_TEST_OBJS = $(patsubst %,$(UNIT_TEST_DIR)/%.o,$(UNIT_TEST_PROGRAMS)) UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o diff --cc builtin/config.c index c38264c999,cc343f55ca..20a0b64090 --- a/builtin/config.c +++ b/builtin/config.c @@@ -288,8 -276,8 +288,8 @@@ static int format_config(const struct c strbuf_addstr(buf, value_); else strbuf_addstr(buf, v ? "true" : "false"); - } else if (type == TYPE_PATH) { + } else if (opts->type == TYPE_PATH) { - const char *v; + char *v; if (git_config_pathname(&v, key_, value_) < 0) return -1; strbuf_addstr(buf, v);