]> git.ipfire.org Git - thirdparty/git.git/commit
submodule--helper: replace malloc with xmalloc
authorSiddharth Shrimali <r.siddharth.shrimali@gmail.com>
Tue, 10 Mar 2026 16:44:12 +0000 (22:14 +0530)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Mar 2026 18:17:56 +0000 (11:17 -0700)
commit35f220b639849d43cd8aaae34ccbe38e9935ab2b
treeab0871eb7bc0396ba49bb3e82e70949741d7b3d6
parent67ad42147a7acc2af6074753ebd03d904476118f
submodule--helper: replace malloc with xmalloc

The submodule_summary_callback() function currently uses a raw malloc()
which could lead to a NULL pointer dereference.

Standardize this by replacing malloc() with xmalloc() for error handling.
To improve maintainability, use sizeof(*temp) instead of the struct name,
and drop the typecast of void pointer assignment.

Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c