Verified Commit 5913e4ce authored by Antonio Cardace's avatar Antonio Cardace Committed by Thomas Haller

initrd: fix memory leak

Signed-off-by: Antonio Cardace's avatarAntonio Cardace <acardace@redhat.com>
Fixes: 9f960955 ('initrd: add configuration generator')
(cherry picked from commit d5c05d07)
(cherry picked from commit bba54613)
(cherry picked from commit 67bb9896)
parent 8bbcc264
Pipeline #198283 passed with stage
in 35 minutes and 7 seconds
......@@ -216,6 +216,14 @@ NM_AUTO_DEFINE_FCN0 (GError *, gs_local_free_error, g_error_free)
#define gs_unref_keyfile nm_auto(gs_local_keyfile_unref)
NM_AUTO_DEFINE_FCN0 (GKeyFile *, gs_local_keyfile_unref, g_key_file_unref)
/**
* gs_free_option_context:
*
* Call g_option_context_free() on a variable location when it goes out of scope.
*/
#define gs_free_option_context nm_auto(gs_local_option_context)
NM_AUTO_DEFINE_FCN0 (GOptionContext *, gs_local_option_context, g_option_context_free);
/*****************************************************************************/
#include "nm-glib.h"
......
......@@ -80,7 +80,7 @@ main (int argc, char *argv[])
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &remaining, NULL, NULL },
{ NULL }
};
GOptionContext *option_context;
gs_free_option_context GOptionContext *option_context = NULL;
GError *error = NULL;
int errsv;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment