[ASAN] sysroot: Fix leak/double free of keyfile origin
Use autoptr rather than manual cleanup. The double free isn't a security problem, since we trust origin files. Closes: #598 Approved by: jlebon
This commit is contained in:
parent
3a459bac2d
commit
1bb6e51486
|
|
@ -133,7 +133,6 @@ OstreeDeployment *
|
||||||
ostree_deployment_clone (OstreeDeployment *self)
|
ostree_deployment_clone (OstreeDeployment *self)
|
||||||
{
|
{
|
||||||
glnx_unref_object OstreeBootconfigParser *new_bootconfig = NULL;
|
glnx_unref_object OstreeBootconfigParser *new_bootconfig = NULL;
|
||||||
GKeyFile *new_origin = NULL;
|
|
||||||
OstreeDeployment *ret = ostree_deployment_new (self->index, self->osname, self->csum,
|
OstreeDeployment *ret = ostree_deployment_new (self->index, self->osname, self->csum,
|
||||||
self->deployserial,
|
self->deployserial,
|
||||||
self->bootcsum, self->bootserial);
|
self->bootcsum, self->bootserial);
|
||||||
|
|
@ -143,6 +142,7 @@ ostree_deployment_clone (OstreeDeployment *self)
|
||||||
|
|
||||||
if (self->origin)
|
if (self->origin)
|
||||||
{
|
{
|
||||||
|
g_autoptr(GKeyFile) new_origin = NULL;
|
||||||
g_autofree char *data = NULL;
|
g_autofree char *data = NULL;
|
||||||
gsize len;
|
gsize len;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
|
||||||
|
|
@ -613,8 +613,6 @@ parse_origin (OstreeSysroot *self,
|
||||||
out:
|
out:
|
||||||
if (error)
|
if (error)
|
||||||
g_prefix_error (error, "Parsing %s: ", origin_path);
|
g_prefix_error (error, "Parsing %s: ", origin_path);
|
||||||
if (ret_origin)
|
|
||||||
g_key_file_unref (ret_origin);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -689,7 +687,7 @@ parse_deployment (OstreeSysroot *self,
|
||||||
glnx_fd_close int deployment_dfd = -1;
|
glnx_fd_close int deployment_dfd = -1;
|
||||||
const char *deploy_basename;
|
const char *deploy_basename;
|
||||||
g_autofree char *treebootserial_target = NULL;
|
g_autofree char *treebootserial_target = NULL;
|
||||||
GKeyFile *origin = NULL;
|
g_autoptr(GKeyFile) origin = NULL;
|
||||||
g_autofree char *unlocked_development_path = NULL;
|
g_autofree char *unlocked_development_path = NULL;
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
|
|
||||||
|
|
@ -751,8 +749,6 @@ parse_deployment (OstreeSysroot *self,
|
||||||
if (out_deployment)
|
if (out_deployment)
|
||||||
*out_deployment = g_steal_pointer (&ret_deployment);
|
*out_deployment = g_steal_pointer (&ret_deployment);
|
||||||
out:
|
out:
|
||||||
if (origin)
|
|
||||||
g_key_file_unref (origin);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue