mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2026-07-08 18:06:18 +00:00
Add function to free Compact Disc ECC context and update cleanup logic
This commit is contained in:
@@ -110,6 +110,8 @@ AARU_EXPORT int32_t AARU_CALL aaruf_cst_untransform(const uint8_t *sequential, u
|
||||
|
||||
AARU_EXPORT void *AARU_CALL aaruf_ecc_cd_init();
|
||||
|
||||
AARU_EXPORT void AARU_CALL aaruf_ecc_cd_free(void *context);
|
||||
|
||||
AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_is_suffix_correct(void *context, const uint8_t *sector);
|
||||
|
||||
AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector);
|
||||
|
||||
@@ -91,6 +91,23 @@ AARU_EXPORT void *AARU_CALL aaruf_ecc_cd_init()
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Frees a Compact Disc ECC context and its internal tables.
|
||||
*
|
||||
* @param ctx Pointer to the CdEccContext to free.
|
||||
*/
|
||||
AARU_EXPORT void AARU_CALL aaruf_ecc_cd_free(void *ctx)
|
||||
{
|
||||
if(!ctx) return;
|
||||
|
||||
CdEccContext *context = (CdEccContext *)ctx;
|
||||
|
||||
free(context->ecc_f_table);
|
||||
free(context->ecc_b_table);
|
||||
free(context->edc_table);
|
||||
free(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 1).
|
||||
*
|
||||
|
||||
@@ -4568,7 +4568,7 @@ AARU_EXPORT int AARU_CALL aaruf_close(void *context)
|
||||
free(ctx->readableSectorTags);
|
||||
ctx->readableSectorTags = NULL;
|
||||
|
||||
free(ctx->ecc_cd_context);
|
||||
aaruf_ecc_cd_free(ctx->ecc_cd_context);
|
||||
ctx->ecc_cd_context = NULL;
|
||||
|
||||
free(ctx->checksums.spamsum);
|
||||
|
||||
Reference in New Issue
Block a user