diff --git a/librepo/downloader.c b/librepo/downloader.c index 7208a407..5b610632 100644 --- a/librepo/downloader.c +++ b/librepo/downloader.c @@ -1357,8 +1357,6 @@ check_zck(LrTarget *target, GError **err) if(cks_good == 1) { // All checksums good g_debug("%s: File is complete", __func__); - if(target->target->zck_dl) - zck_dl_free(&(target->target->zck_dl)); target->zck_state = LR_ZCK_DL_FINISHED; return TRUE; } @@ -1378,8 +1376,6 @@ check_zck(LrTarget *target, GError **err) } if(cks_good == 1) { // All checksums good - if(target->target->zck_dl) - zck_dl_free(&(target->target->zck_dl)); target->zck_state = LR_ZCK_DL_FINISHED; return TRUE; } diff --git a/librepo/downloadtarget.c b/librepo/downloadtarget.c index 6825aef3..e502968a 100644 --- a/librepo/downloadtarget.c +++ b/librepo/downloadtarget.c @@ -134,6 +134,26 @@ lr_downloadtarget_free(LrDownloadTarget *target) if (!target) return; + #ifdef WITH_ZCHUNK + if (target->zck_dl) { + zckCtx *old_zck = zck_dl_get_zck(target->zck_dl); + if (old_zck) { + zck_free(&old_zck); + } + + zckRange *old_range = zck_dl_get_range(target->zck_dl); + if(old_range) { + zck_range_free(&old_range); + } + + zck_dl_free(&target->zck_dl); + } + #endif /* WITH_ZCHUNK */ + + if(target->range) { + free(target->range); + } + g_slist_free_full(target->checksums, (GDestroyNotify) lr_downloadtargetchecksum_free); g_string_chunk_free(target->chunk);