From: Michael Tremer Date: Mon, 27 Jan 2025 17:29:27 +0000 (+0000) Subject: xfer: Don't crash if xfer finishes too early X-Git-Tag: 0.9.30~335 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fdd851099bc836d87b5b5150f54767e966c1def0;p=pakfire.git xfer: Don't crash if xfer finishes too early Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/xfer.c b/src/pakfire/xfer.c index 9758c41d..32af2f57 100644 --- a/src/pakfire/xfer.c +++ b/src/pakfire/xfer.c @@ -1211,9 +1211,11 @@ pakfire_xfer_error_code_t pakfire_xfer_done(struct pakfire_xfer* xfer, int code) curl_off_t upload_speed = 0; // Finish progress - r = pakfire_progress_finish(xfer->progress); - if (r) - return r; + if (xfer->progress) { + r = pakfire_progress_finish(xfer->progress); + if (r < 0) + goto ERROR; + } // Log the result DEBUG(xfer->ctx, "cURL xfer done: %d - %s\n", code, curl_easy_strerror(code));