From 9934e228aca7004c5ad4dbd01d4e0c59ceb428bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Fri, 21 Feb 2020 17:46:41 +0100 Subject: [PATCH] * src/retr.c (fd_read_body): Check timer before accessing (Coverity #600494) --- src/retr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/retr.c b/src/retr.c index c227f8d7..3fa83bcb 100644 --- a/src/retr.c +++ b/src/retr.c @@ -559,10 +559,12 @@ fd_read_body (const char *downloaded_filename, int fd, FILE *out, wgint toread, if (progress) progress_finish (progress, ptimer_read (timer)); - if (elapsed) - *elapsed = ptimer_read (timer); if (timer) - ptimer_destroy (timer); + { + if (elapsed) + *elapsed = ptimer_read (timer); + ptimer_destroy (timer); + } #ifdef HAVE_LIBZ if (gzbuf != NULL)