Fix memory leak in static options parser.

This commit is contained in:
H. Utku Maden 2023-08-20 18:12:21 +03:00
parent 1c75c9d7c5
commit 9fed914164
Signed by: themixedupstuff
GPG Key ID: 25A001B636F17843

@ -132,7 +132,7 @@ MX_API void mx_options_end_r(mx_options_t *self);
*/ */
MX_INLINE mx_options_t* __mx_options_ptr() MX_INLINE mx_options_t* __mx_options_ptr()
{ {
static mx_options_t opts = { }; static mx_options_t opts = { 0 };
return &opts; return &opts;
} }
@ -144,6 +144,7 @@ MX_INLINE mx_options_t* __mx_options_ptr()
*/ */
MX_INLINE void mx_options_begin(mx_optflag_t flags, int argc, char **argv) MX_INLINE void mx_options_begin(mx_optflag_t flags, int argc, char **argv)
{ {
mx_options_end_r(__mx_options_ptr());
mx_options_begin_r(__mx_options_ptr(), flags, argc, argv); mx_options_begin_r(__mx_options_ptr(), flags, argc, argv);
} }