From: lidongyan <502024330056@smail.nju.edu.cn> Date: Wed, 07 May 2025 12:19:29 GMT Subject: Re: [PATCH 3/3] fix: use strvec_push_wrapper to prevent ubsan failure Message-ID: <1CEABFA7-474C-4253-BB92-E3F153213F5C@smail.nju.edu.cn> In-Reply-To: Thank you for your suggestion. I will squash all the commits and include a detailed description in the next submission. In short, calling parse_options may cause a memory leak when encountering unknown short options. To fix the leak, parse_options can use a user-provided allocation function, so that the user can later free the memory and avoid the leak. I also defined a macro called OPT_UNKNOWN to make it easier for users to pass in their own allocation function. On the other hand, I think a new file should be added under t/helper/. The reason is that this new file not only serves as a test, but also provides a simple example of using OPT_UNKNOWN, which others can refer to when modifying their own option definitions to avoid memory leaks. > 2025年5月7日 15:54,Patrick Steinhardt 写道: > > On Wed, May 07, 2025 at 02:33:23AM +0000, Lidong Yan via GitGitGadget wrote: >> From: Lidong Yan <502024330056@smail.nju.edu.cn> >> >> Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> > > This looks like another fixup-style commit. I assume that all of this > really should be a single commit, as the latter two commits don't seem > to do anything new compared to the first commit. > > Patrick >