fetcher/curl: Fix leaks caught by ASAN

I had to rebuild `glib` with `-fsanitize=address` in order to get a stack trace
to finally get this one.  However, *installing* that glib "system wide"
in my container breaks everything (including `rpm-ostree`, `dnf`, `pkg-config` etc.)
that wasn't built with ASAN.

So my test scenario right now is to extract the libs and do e.g.:
```
make && env LD_LIBRARY_PATH=$HOME/src/distgit/fedora/glib2/asan-libs make check TESTS=tests/test-basic.sh
```

Closes: #719
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-03-04 10:11:15 -05:00 committed by Atomic Bot
parent f667a82fc1
commit 72336f1c48

View File

@ -416,11 +416,13 @@ timer_cb (gpointer data)
{
OstreeFetcher *fetcher = data;
CURLMcode rc;
GSource *orig_src = fetcher->timer_event;
fetcher->timer_event = NULL;
rc = curl_multi_socket_action (fetcher->multi, CURL_SOCKET_TIMEOUT, 0, &fetcher->curl_running);
g_assert (rc == CURLM_OK);
check_multi_info (fetcher);
if (fetcher->timer_event == orig_src)
fetcher->timer_event = NULL;
return FALSE;
}
@ -713,6 +715,8 @@ initiate_next_curl_request (FetcherRequest *req,
CURLMcode rc;
OstreeFetcher *self = req->fetcher;
if (req->easy)
curl_easy_cleanup (req->easy);
req->easy = curl_easy_init ();
g_assert (req->easy);