download: Abort on calloc fail

This commit is contained in:
Otavio Pontes
2018-08-21 17:04:43 -07:00
committed by Matthew Johnson
parent 489a11adfc
commit bdb6d1cebd
+6
View File
@@ -146,6 +146,9 @@ static void free_curl_file(struct swupd_curl_parallel_handle *h, struct multi_cu
void *swupd_curl_parallel_download_start(size_t max_xfer, size_t max_xfer_bottom, swupd_curl_download_cb success_cb)
{
struct swupd_curl_parallel_handle *h = calloc(1, sizeof(struct swupd_curl_parallel_handle));
if (!h) {
abort();
}
h->mcurl = curl_multi_init();
if (h->mcurl == NULL) {
@@ -424,6 +427,9 @@ int swupd_curl_parallel_download_enqueue(void *handle, const char *url, const ch
h = handle;
file = calloc(1, sizeof(struct multi_curl_file));
if (!file) {
abort();
}
file->file.path = strdup_or_die(filename);
file->url = strdup_or_die(url);
file->data = data;