initrd: fix memory leak

Signed-off-by: Antonio Cardace's avatarAntonio Cardace <acardace@redhat.com>
Fixes: 9f960955 ('initrd: add configuration generator')
parent d619de77
Pipeline #197311 failed with stages
in 8 minutes and 27 seconds
......@@ -141,6 +141,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"
......
......@@ -83,7 +83,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;
gs_free_error GError *error = NULL;
gs_free char *hostname = 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