From bdb6d1cebd96be1edadfea2e8971dad10f9b9a3e Mon Sep 17 00:00:00 2001 From: Otavio Pontes Date: Mon, 16 Jul 2018 21:47:32 +0000 Subject: [PATCH] download: Abort on calloc fail --- src/download.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/download.c b/src/download.c index ad2c47fd..fb176049 100644 --- a/src/download.c +++ b/src/download.c @@ -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;