trivial-httpd: Fix leak of option context
Right now our valgrind runs also end up valgrinding the `trivial-httpd` code, so while it doesn't matter, let's fix this leak anyways. We need to avoid calling `_exit()` since that won't run the cleanup functions. Closes: #410 Approved by: giuseppe
This commit is contained in:
parent
bac1fa1839
commit
7f335a8437
|
|
@ -386,7 +386,7 @@ gboolean
|
||||||
ostree_builtin_trivial_httpd (int argc, char **argv, GCancellable *cancellable, GError **error)
|
ostree_builtin_trivial_httpd (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
GOptionContext *context;
|
g_autoptr(GOptionContext) context = NULL;
|
||||||
const char *dirpath;
|
const char *dirpath;
|
||||||
OtTrivialHttpd appstruct = { 0, };
|
OtTrivialHttpd appstruct = { 0, };
|
||||||
OtTrivialHttpd *app = &appstruct;
|
OtTrivialHttpd *app = &appstruct;
|
||||||
|
|
@ -501,8 +501,8 @@ ostree_builtin_trivial_httpd (int argc, char **argv, GCancellable *cancellable,
|
||||||
}
|
}
|
||||||
else if (pid > 0)
|
else if (pid > 0)
|
||||||
{
|
{
|
||||||
/* Parent */
|
ret = TRUE;
|
||||||
_exit (0);
|
goto out;
|
||||||
}
|
}
|
||||||
/* Child, continue */
|
/* Child, continue */
|
||||||
/* Daemonising: close stdout/stderr so $() et al work on us */
|
/* Daemonising: close stdout/stderr so $() et al work on us */
|
||||||
|
|
@ -559,7 +559,5 @@ ostree_builtin_trivial_httpd (int argc, char **argv, GCancellable *cancellable,
|
||||||
out:
|
out:
|
||||||
g_clear_object (&app->root);
|
g_clear_object (&app->root);
|
||||||
g_clear_object (&app->log);
|
g_clear_object (&app->log);
|
||||||
if (context)
|
|
||||||
g_option_context_free (context);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue