On Tue, Apr 19, 2016 at 09:35:45PM +0100, Sami Kerola wrote: > The getopt(1) is short living command, and one could argue ensuring all > allocations are freed at end of execution is waste of time. There is a > point in that, but making test-suite runs to be less noisy with ASAN is also > nice as it encourages reading the errors when/if they happen. > > Reviewed-by: Yuriy M. Kaminskiy <yumkam@xxxxxxxxx> > Reviewed-by: Karel Zak <kzak@xxxxxxxxxx> > Signed-off-by: Sami Kerola <kerolasa@xxxxxx> > --- > misc-utils/getopt.c | 25 ++++++++++++++++++------- > 1 file changed, 18 insertions(+), 7 deletions(-) > > diff --git a/misc-utils/getopt.c b/misc-utils/getopt.c > index 2cff2eb..dc2a976 100644 > --- a/misc-utils/getopt.c > +++ b/misc-utils/getopt.c > @@ -86,6 +86,7 @@ struct getopt_control { > int long_options_length; /* length of options array */ > int long_options_nr; /* number of used elements in array */ > unsigned int > + free_name:1, /* free up argv[0] after printout */ I did a change to the code, it seems more elegant to keep pointer to the 'name' in the control struct than maintain free_name flag and call free(argv[0]). https://github.com/karelzak/util-linux/commit/e402d6d3b149c34faa5abd5a0cef8284b4ae1af3 Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html