{"thread":{"id":"63420","subject":"[PATCH] REFTABLE_REALLOC_ARRAY: fix potential memory leak if realloc failed","startedAt":"2025-05-08T13:39:46Z","lastAt":"2025-05-09T14:26:00Z","messageCount":10,"participants":["Lidong Yan via GitGitGadget","René Scharfe","lidongyan","Junio C Hamano","Patrick Steinhardt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"517551","messageId":"pull.1955.git.git.1746711583166.gitgitgadget@gmail.com","threadId":"63420","inReplyTo":null,"subject":"[PATCH] REFTABLE_REALLOC_ARRAY: fix potential memory leak if realloc failed","fromName":"Lidong Yan via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-05-08T13:39:43Z","receivedAt":"2025-05-08T13:39:46Z","isPatch":true,"sender":{"key":"yldhome2d2@gmail.com","avatar":"https://avatars.githubusercontent.com/u/77328395?v=4"},"body":"From: Lidong Yan <502024330056@smail.nju.edu.cn>\n\nREFTABLE_REALLOC_ARRAY doesn't free origin pointer when reftable_realloc\nfailed. This leak can be fixed by add a free(x) before set x to NULL.\n\nSigned-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>\n---\n    REFTABLE_REALLOC_ARRAY: fix potential memory leak if realloc failed\n    \n    REFTABLE_REALLOC_ARRAY doesn't free origin pointer when reftable_realloc\n    failed. This leak can be fixed by add a free(x) before set x to NULL.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1955%2Fbrandb97%2Ffix-REFTABLE-REALLOC-leak-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1955/brandb97/fix-REFTABLE-REALLOC-leak-v1\nPull-Request: https://github.com/git/git/pull/1955\n\n reftable/basics.h | 28 ++++++++++++++++++++--------\n 1 file changed, 20 insertions(+), 8 deletions(-)\n\ndiff --git a/reftable/basics.h b/reftable/basics.h\nindex d8888c12629..c7651f0cda8 100644\n--- a/reftable/basics.h\n+++ b/reftable/basics.h\n@@ -200,14 +200,26 @@ static inline int reftable_alloc_size(size_t nelem, size_t elsize, size_t *out)\n \t\t} \\\n \t} while (0)\n #define REFTABLE_CALLOC_ARRAY(x, alloc) (x) = reftable_calloc((alloc), sizeof(*(x)))\n-#define REFTABLE_REALLOC_ARRAY(x, alloc) do { \\\n-\t\tsize_t alloc_size; \\\n-\t\tif (reftable_alloc_size(sizeof(*(x)), (alloc), &alloc_size) < 0) { \\\n-\t\t\terrno = ENOMEM; \\\n-\t\t\t(x) = NULL; \\\n-\t\t} else { \\\n-\t\t\t(x) = reftable_realloc((x), alloc_size); \\\n-\t\t} \\\n+#define REFTABLE_REALLOC_ARRAY(x, alloc)                                      \\\n+\tdo {                                                                  \\\n+\t\tsize_t alloc_size;                                            \\\n+\t\tvoid *new_p;                                                  \\\n+\t\tif (reftable_alloc_size(sizeof(*(x)), (alloc), &alloc_size) < \\\n+\t\t    0) {                                                      \\\n+\t\t\tgoto cleanup;                                         \\\n+\t\t} else {                                                      \\\n+\t\t\tnew_p = reftable_realloc((x), alloc_size);            \\\n+\t\t\tif (!new_p) {                                         \\\n+\t\t\t\tgoto cleanup;                                 \\\n+\t\t\t}                                                     \\\n+\t\t\t(x) = new_p;                                          \\\n+\t\t}                                                             \\\n+\t\tbreak;                                                        \\\n+\tcleanup:                                                              \\\n+\t\tif (x)                                                        \\\n+\t\t\tfree(x);                                              \\\n+\t\terrno = ENOMEM;                                               \\\n+\t\t(x) = NULL;                                                   \\\n \t} while (0)\n \n static inline void *reftable_alloc_grow(void *p, size_t nelem, size_t elsize,\n\nbase-commit: 6f84262c44a89851c3ae5a6e4c1a9d06b2068d75\n-- \ngitgitgadget\n"},{"id":"517602","messageId":"174cb568-e2bd-41e0-b090-eadd919d1ddd@web.de","threadId":"63420","inReplyTo":"pull.1955.git.git.1746711583166.gitgitgadget@gmail.com","subject":"Re: [PATCH] REFTABLE_REALLOC_ARRAY: fix potential memory leak if realloc failed","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2025-05-08T21:42:37Z","receivedAt":"2025-05-08T21:42:51Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 08.05.25 um 15:39 schrieb Lidong Yan via GitGitGadget:\n> From: Lidong Yan <502024330056@smail.nju.edu.cn>\n> \n> REFTABLE_REALLOC_ARRAY doesn't free origin pointer when reftable_realloc\n> failed. This leak can be fixed by add a free(x) before set x to NULL.\n\nHmm, this macro is unused.  Perhaps remove it?\n\nRené\n\n"},{"id":"517618","messageId":"4B1B3827-C617-4026-BE09-DBD91DCB5FF1@smail.nju.edu.cn","threadId":"63420","inReplyTo":"174cb568-e2bd-41e0-b090-eadd919d1ddd@web.de","subject":"Re: [PATCH] REFTABLE_REALLOC_ARRAY: fix potential memory leak if realloc failed","fromName":"lidongyan","fromEmail":"502024330056@smail.nju.edu.cn","sentAt":"2025-05-09T01:54:05Z","receivedAt":"2025-05-09T01:54:27Z","isPatch":true,"sender":{"key":"502024330056@smail.nju.edu.cn","avatar":"https://avatars.githubusercontent.com/u/77328395?v=4"},"body":"Ok, I will remove it in the next patch.\n\n> 2025年5月9日 05:42，René Scharfe <l.s.r@web.de> 写道：\n> \n> Am 08.05.25 um 15:39 schrieb Lidong Yan via GitGitGadget:\n>> From: Lidong Yan <502024330056@smail.nju.edu.cn>\n>> \n>> REFTABLE_REALLOC_ARRAY doesn't free origin pointer when reftable_realloc\n>> failed. This leak can be fixed by add a free(x) before set x to NULL.\n> \n> Hmm, this macro is unused.  Perhaps remove it?\n> \n> René\n> \n> \n\n"},{"id":"517620","messageId":"pull.1955.v2.git.git.1746756263207.gitgitgadget@gmail.com","threadId":"63420","inReplyTo":"pull.1955.git.git.1746711583166.gitgitgadget@gmail.com","subject":"[PATCH v2] REFTABLE_REALLOC_ARRAY: remove this unsafe yet unused macro","fromName":"Lidong Yan via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-05-09T02:04:22Z","receivedAt":"2025-05-09T02:04:26Z","isPatch":true,"sender":{"key":"yldhome2d2@gmail.com","avatar":"https://avatars.githubusercontent.com/u/77328395?v=4"},"body":"From: Lidong Yan <502024330056@smail.nju.edu.cn>\n\nREFTABLE_REALLOC_ARRAY will cause memory leak if realloc failed.\nSince it is unused, remove this unsafe macro.\n\nSigned-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>\n---\n    REFTABLE_REALLOC_ARRAY: fix potential memory leak if realloc failed\n    \n    REFTABLE_REALLOC_ARRAY doesn't free origin pointer when reftable_realloc\n    failed. This leak can be fixed by add a free(x) before set x to NULL.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1955%2Fbrandb97%2Ffix-REFTABLE-REALLOC-leak-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1955/brandb97/fix-REFTABLE-REALLOC-leak-v2\nPull-Request: https://github.com/git/git/pull/1955\n\nRange-diff vs v1:\n\n 1:  4d786a0ec17 ! 1:  6cc191f9db8 REFTABLE_REALLOC_ARRAY: fix potential memory leak if realloc failed\n     @@ Metadata\n      Author: Lidong Yan <502024330056@smail.nju.edu.cn>\n      \n       ## Commit message ##\n     -    REFTABLE_REALLOC_ARRAY: fix potential memory leak if realloc failed\n     +    REFTABLE_REALLOC_ARRAY: remove this unsafe yet unused macro\n      \n     -    REFTABLE_REALLOC_ARRAY doesn't free origin pointer when reftable_realloc\n     -    failed. This leak can be fixed by add a free(x) before set x to NULL.\n     +    REFTABLE_REALLOC_ARRAY will cause memory leak if realloc failed.\n     +    Since it is unused, remove this unsafe macro.\n      \n          Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>\n      \n       ## reftable/basics.h ##\n      @@ reftable/basics.h: static inline int reftable_alloc_size(size_t nelem, size_t elsize, size_t *out)\n     + \t\t\t(x) = reftable_malloc(alloc_size); \\\n       \t\t} \\\n       \t} while (0)\n     - #define REFTABLE_CALLOC_ARRAY(x, alloc) (x) = reftable_calloc((alloc), sizeof(*(x)))\n     +-#define REFTABLE_CALLOC_ARRAY(x, alloc) (x) = reftable_calloc((alloc), sizeof(*(x)))\n      -#define REFTABLE_REALLOC_ARRAY(x, alloc) do { \\\n      -\t\tsize_t alloc_size; \\\n      -\t\tif (reftable_alloc_size(sizeof(*(x)), (alloc), &alloc_size) < 0) { \\\n     @@ reftable/basics.h: static inline int reftable_alloc_size(size_t nelem, size_t el\n      -\t\t} else { \\\n      -\t\t\t(x) = reftable_realloc((x), alloc_size); \\\n      -\t\t} \\\n     -+#define REFTABLE_REALLOC_ARRAY(x, alloc)                                      \\\n     -+\tdo {                                                                  \\\n     -+\t\tsize_t alloc_size;                                            \\\n     -+\t\tvoid *new_p;                                                  \\\n     -+\t\tif (reftable_alloc_size(sizeof(*(x)), (alloc), &alloc_size) < \\\n     -+\t\t    0) {                                                      \\\n     -+\t\t\tgoto cleanup;                                         \\\n     -+\t\t} else {                                                      \\\n     -+\t\t\tnew_p = reftable_realloc((x), alloc_size);            \\\n     -+\t\t\tif (!new_p) {                                         \\\n     -+\t\t\t\tgoto cleanup;                                 \\\n     -+\t\t\t}                                                     \\\n     -+\t\t\t(x) = new_p;                                          \\\n     -+\t\t}                                                             \\\n     -+\t\tbreak;                                                        \\\n     -+\tcleanup:                                                              \\\n     -+\t\tif (x)                                                        \\\n     -+\t\t\tfree(x);                                              \\\n     -+\t\terrno = ENOMEM;                                               \\\n     -+\t\t(x) = NULL;                                                   \\\n     - \t} while (0)\n     +-\t} while (0)\n     ++#define REFTABLE_CALLOC_ARRAY(x, alloc) \\\n     ++\t(x) = reftable_calloc((alloc), sizeof(*(x)))\n       \n       static inline void *reftable_alloc_grow(void *p, size_t nelem, size_t elsize,\n     + \t\t\t\t\tsize_t *allocp)\n\n\n reftable/basics.h | 12 ++----------\n 1 file changed, 2 insertions(+), 10 deletions(-)\n\ndiff --git a/reftable/basics.h b/reftable/basics.h\nindex d8888c12629..667feffd935 100644\n--- a/reftable/basics.h\n+++ b/reftable/basics.h\n@@ -199,16 +199,8 @@ static inline int reftable_alloc_size(size_t nelem, size_t elsize, size_t *out)\n \t\t\t(x) = reftable_malloc(alloc_size); \\\n \t\t} \\\n \t} while (0)\n-#define REFTABLE_CALLOC_ARRAY(x, alloc) (x) = reftable_calloc((alloc), sizeof(*(x)))\n-#define REFTABLE_REALLOC_ARRAY(x, alloc) do { \\\n-\t\tsize_t alloc_size; \\\n-\t\tif (reftable_alloc_size(sizeof(*(x)), (alloc), &alloc_size) < 0) { \\\n-\t\t\terrno = ENOMEM; \\\n-\t\t\t(x) = NULL; \\\n-\t\t} else { \\\n-\t\t\t(x) = reftable_realloc((x), alloc_size); \\\n-\t\t} \\\n-\t} while (0)\n+#define REFTABLE_CALLOC_ARRAY(x, alloc) \\\n+\t(x) = reftable_calloc((alloc), sizeof(*(x)))\n \n static inline void *reftable_alloc_grow(void *p, size_t nelem, size_t elsize,\n \t\t\t\t\tsize_t *allocp)\n\nbase-commit: 6f84262c44a89851c3ae5a6e4c1a9d06b2068d75\n-- \ngitgitgadget\n"},{"id":"517621","messageId":"xmqqzffm30vs.fsf@gitster.g","threadId":"63420","inReplyTo":"174cb568-e2bd-41e0-b090-eadd919d1ddd@web.de","subject":"Re: [PATCH] REFTABLE_REALLOC_ARRAY: fix potential memory leak if realloc failed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-05-09T03:43:03Z","receivedAt":"2025-05-09T03:43:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <l.s.r@web.de> writes:\n\n> Am 08.05.25 um 15:39 schrieb Lidong Yan via GitGitGadget:\n>> From: Lidong Yan <502024330056@smail.nju.edu.cn>\n>> \n>> REFTABLE_REALLOC_ARRAY doesn't free origin pointer when reftable_realloc\n>> failed. This leak can be fixed by add a free(x) before set x to NULL.\n>\n> Hmm, this macro is unused.  Perhaps remove it?\n\nOr let the sleeping dog alone, perhaps?\n"},{"id":"517625","messageId":"aB2l_WaBFyz5POld@pks.im","threadId":"63420","inReplyTo":"pull.1955.v2.git.git.1746756263207.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] REFTABLE_REALLOC_ARRAY: remove this unsafe yet unused macro","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-05-09T06:51:41Z","receivedAt":"2025-05-09T06:51:50Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, May 09, 2025 at 02:04:22AM +0000, Lidong Yan via GitGitGadget wrote:\n> diff --git a/reftable/basics.h b/reftable/basics.h\n> index d8888c12629..667feffd935 100644\n> --- a/reftable/basics.h\n> +++ b/reftable/basics.h\n> @@ -199,16 +199,8 @@ static inline int reftable_alloc_size(size_t nelem, size_t elsize, size_t *out)\n>  \t\t\t(x) = reftable_malloc(alloc_size); \\\n>  \t\t} \\\n>  \t} while (0)\n> -#define REFTABLE_CALLOC_ARRAY(x, alloc) (x) = reftable_calloc((alloc), sizeof(*(x)))\n> -#define REFTABLE_REALLOC_ARRAY(x, alloc) do { \\\n> -\t\tsize_t alloc_size; \\\n> -\t\tif (reftable_alloc_size(sizeof(*(x)), (alloc), &alloc_size) < 0) { \\\n> -\t\t\terrno = ENOMEM; \\\n> -\t\t\t(x) = NULL; \\\n> -\t\t} else { \\\n> -\t\t\t(x) = reftable_realloc((x), alloc_size); \\\n> -\t\t} \\\n> -\t} while (0)\n> +#define REFTABLE_CALLOC_ARRAY(x, alloc) \\\n> +\t(x) = reftable_calloc((alloc), sizeof(*(x)))\n\nLet's avoid reformatting unrelated macros. But other than that I fully\nagree -- we should remove stuff that we don't use in the first place.\n\nThanks!\n\nPatrick\n"},{"id":"517629","messageId":"02E0C9C6-3A1A-480C-834A-BB30C3170C78@smail.nju.edu.cn","threadId":"63420","inReplyTo":"aB2l_WaBFyz5POld@pks.im","subject":"Re: [PATCH v2] REFTABLE_REALLOC_ARRAY: remove this unsafe yet unused macro","fromName":"lidongyan","fromEmail":"502024330056@smail.nju.edu.cn","sentAt":"2025-05-09T07:38:14Z","receivedAt":"2025-05-09T07:38:45Z","isPatch":true,"sender":{"key":"502024330056@smail.nju.edu.cn","avatar":"https://avatars.githubusercontent.com/u/77328395?v=4"},"body":"2025年5月9日 14:51，Patrick Steinhardt <ps@pks.im> 写道：\n> \n> On Fri, May 09, 2025 at 02:04:22AM +0000, Lidong Yan via GitGitGadget wrote:\n>> diff --git a/reftable/basics.h b/reftable/basics.h\n>> index d8888c12629..667feffd935 100644\n>> --- a/reftable/basics.h\n>> +++ b/reftable/basics.h\n>> @@ -199,16 +199,8 @@ static inline int reftable_alloc_size(size_t nelem, size_t elsize, size_t *out)\n>> (x) = reftable_malloc(alloc_size); \\\n>> } \\\n>> } while (0)\n>> -#define REFTABLE_CALLOC_ARRAY(x, alloc) (x) = reftable_calloc((alloc), sizeof(*(x)))\n>> -#define REFTABLE_REALLOC_ARRAY(x, alloc) do { \\\n>> - size_t alloc_size; \\\n>> - if (reftable_alloc_size(sizeof(*(x)), (alloc), &alloc_size) < 0) { \\\n>> - errno = ENOMEM; \\\n>> - (x) = NULL; \\\n>> - } else { \\\n>> - (x) = reftable_realloc((x), alloc_size); \\\n>> - } \\\n>> - } while (0)\n>> +#define REFTABLE_CALLOC_ARRAY(x, alloc) \\\n>> + (x) = reftable_calloc((alloc), sizeof(*(x)))\n> \n> Let's avoid reformatting unrelated macros. But other than that I fully\n> agree -- we should remove stuff that we don't use in the first place.\n> \n> Thanks!\n> \n> Patrick\n> \n\nOk, I will restore REFTABLE_CALLOC_ARRAY in the next patch."},{"id":"517630","messageId":"pull.1955.v3.git.git.1746776686718.gitgitgadget@gmail.com","threadId":"63420","inReplyTo":"pull.1955.v2.git.git.1746756263207.gitgitgadget@gmail.com","subject":"[PATCH v3] REFTABLE_REALLOC_ARRAY: remove this unsafe yet unused macro","fromName":"Lidong Yan via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-05-09T07:44:46Z","receivedAt":"2025-05-09T07:44:51Z","isPatch":true,"sender":{"key":"yldhome2d2@gmail.com","avatar":"https://avatars.githubusercontent.com/u/77328395?v=4"},"body":"From: Lidong Yan <502024330056@smail.nju.edu.cn>\n\nREFTABLE_REALLOC_ARRAY will cause memory leak if realloc failed.\nSince it is unused, remove this unsafe macro.\n\nSigned-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>\n---\n    REFTABLE_REALLOC_ARRAY: fix potential memory leak if realloc failed\n    \n    REFTABLE_REALLOC_ARRAY doesn't free origin pointer when reftable_realloc\n    failed. This leak can be fixed by add a free(x) before set x to NULL.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1955%2Fbrandb97%2Ffix-REFTABLE-REALLOC-leak-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1955/brandb97/fix-REFTABLE-REALLOC-leak-v3\nPull-Request: https://github.com/git/git/pull/1955\n\nRange-diff vs v2:\n\n 1:  6cc191f9db8 ! 1:  107f9ce3bd0 REFTABLE_REALLOC_ARRAY: remove this unsafe yet unused macro\n     @@ Commit message\n      \n       ## reftable/basics.h ##\n      @@ reftable/basics.h: static inline int reftable_alloc_size(size_t nelem, size_t elsize, size_t *out)\n     - \t\t\t(x) = reftable_malloc(alloc_size); \\\n       \t\t} \\\n       \t} while (0)\n     --#define REFTABLE_CALLOC_ARRAY(x, alloc) (x) = reftable_calloc((alloc), sizeof(*(x)))\n     + #define REFTABLE_CALLOC_ARRAY(x, alloc) (x) = reftable_calloc((alloc), sizeof(*(x)))\n      -#define REFTABLE_REALLOC_ARRAY(x, alloc) do { \\\n      -\t\tsize_t alloc_size; \\\n      -\t\tif (reftable_alloc_size(sizeof(*(x)), (alloc), &alloc_size) < 0) { \\\n     @@ reftable/basics.h: static inline int reftable_alloc_size(size_t nelem, size_t el\n      -\t\t\t(x) = reftable_realloc((x), alloc_size); \\\n      -\t\t} \\\n      -\t} while (0)\n     -+#define REFTABLE_CALLOC_ARRAY(x, alloc) \\\n     -+\t(x) = reftable_calloc((alloc), sizeof(*(x)))\n       \n       static inline void *reftable_alloc_grow(void *p, size_t nelem, size_t elsize,\n       \t\t\t\t\tsize_t *allocp)\n\n\n reftable/basics.h | 9 ---------\n 1 file changed, 9 deletions(-)\n\ndiff --git a/reftable/basics.h b/reftable/basics.h\nindex d8888c12629..1674a6f8b80 100644\n--- a/reftable/basics.h\n+++ b/reftable/basics.h\n@@ -200,15 +200,6 @@ static inline int reftable_alloc_size(size_t nelem, size_t elsize, size_t *out)\n \t\t} \\\n \t} while (0)\n #define REFTABLE_CALLOC_ARRAY(x, alloc) (x) = reftable_calloc((alloc), sizeof(*(x)))\n-#define REFTABLE_REALLOC_ARRAY(x, alloc) do { \\\n-\t\tsize_t alloc_size; \\\n-\t\tif (reftable_alloc_size(sizeof(*(x)), (alloc), &alloc_size) < 0) { \\\n-\t\t\terrno = ENOMEM; \\\n-\t\t\t(x) = NULL; \\\n-\t\t} else { \\\n-\t\t\t(x) = reftable_realloc((x), alloc_size); \\\n-\t\t} \\\n-\t} while (0)\n \n static inline void *reftable_alloc_grow(void *p, size_t nelem, size_t elsize,\n \t\t\t\t\tsize_t *allocp)\n\nbase-commit: 6f84262c44a89851c3ae5a6e4c1a9d06b2068d75\n-- \ngitgitgadget\n"},{"id":"517632","messageId":"aB27k8DI3BNgiwS-@pks.im","threadId":"63420","inReplyTo":"pull.1955.v3.git.git.1746776686718.gitgitgadget@gmail.com","subject":"Re: [PATCH v3] REFTABLE_REALLOC_ARRAY: remove this unsafe yet unused macro","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-05-09T08:23:47Z","receivedAt":"2025-05-09T08:23:52Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, May 09, 2025 at 07:44:46AM +0000, Lidong Yan via GitGitGadget wrote:\n> From: Lidong Yan <502024330056@smail.nju.edu.cn>\n> \n> REFTABLE_REALLOC_ARRAY will cause memory leak if realloc failed.\n> Since it is unused, remove this unsafe macro.\n\nThis looks good to me, thanks!\n\nPatrick\n"},{"id":"517682","messageId":"xmqqv7q93lor.fsf@gitster.g","threadId":"63420","inReplyTo":"aB27k8DI3BNgiwS-@pks.im","subject":"Re: [PATCH v3] REFTABLE_REALLOC_ARRAY: remove this unsafe yet unused macro","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-05-09T14:25:56Z","receivedAt":"2025-05-09T14:26:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> On Fri, May 09, 2025 at 07:44:46AM +0000, Lidong Yan via GitGitGadget wrote:\n>> From: Lidong Yan <502024330056@smail.nju.edu.cn>\n>> \n>> REFTABLE_REALLOC_ARRAY will cause memory leak if realloc failed.\n>> Since it is unused, remove this unsafe macro.\n>\n> This looks good to me, thanks!\n\nAlright.  As long as we do not foresee adding a new caller of this\nin the near future, removal is always preferred ;-)\n\nThanks.\n"}]}