fetcher/curl: Fix invalid memory access in finalize()

Reorder cleanup functions so that curl_multi_cleanup() runs before
self->sockets is destroyed. This avoids an assert and invalid memory
access in sock_cb where self->sockets is dereferenced during
curl_multi_cleanup().

Closes: https://github.com/ostreedev/ostree/issues/1331

Closes: #1332
Approved by: cgwalters
This commit is contained in:
Kalev Lember 2017-11-07 16:10:45 +01:00 committed by Atomic Bot
parent 7d2ad351c4
commit 176a7b4778
1 changed files with 1 additions and 1 deletions

View File

@ -167,6 +167,7 @@ _ostree_fetcher_finalize (GObject *object)
{
OstreeFetcher *self = OSTREE_FETCHER (object);
curl_multi_cleanup (self->multi);
g_free (self->remote_name);
g_free (self->cookie_jar_path);
g_free (self->proxy);
@ -177,7 +178,6 @@ _ostree_fetcher_finalize (GObject *object)
g_clear_pointer (&self->timer_event, (GDestroyNotify)destroy_and_unref_source);
if (self->mainctx)
g_main_context_unref (self->mainctx);
curl_multi_cleanup (self->multi);
G_OBJECT_CLASS (_ostree_fetcher_parent_class)->finalize (object);
}