]> git.ipfire.org Git - pakfire.git/commitdiff
xfer: Don't crash if xfer finishes too early
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Jan 2025 17:29:27 +0000 (17:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Jan 2025 17:29:27 +0000 (17:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/xfer.c

index 9758c41d90e75681577142b4459c0bf916bb9dff..32af2f579450489d83bb24727d408822d2b349bd 100644 (file)
@@ -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));