From e5ec2b16be92dc659ab44487708da1395cee0a40 Mon Sep 17 00:00:00 2001 From: xkernel Date: Thu, 26 Oct 2023 17:29:51 +0800 Subject: [PATCH] optimize the code in cmsFreeProfileSequenceDescription() --- src/cmsnamed.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmsnamed.c b/src/cmsnamed.c index 43806dd4..ccf040ab 100644 --- a/src/cmsnamed.c +++ b/src/cmsnamed.c @@ -817,15 +817,16 @@ void CMSEXPORT cmsFreeProfileSequenceDescription(cmsSEQ* pseq) if (pseq == NULL) return; - for (i=0; i < pseq ->n; i++) { - if (pseq->seq != NULL) { + if (pseq ->seq != NULL) { + for (i=0; i < pseq ->n; i++) { if (pseq ->seq[i].Manufacturer != NULL) cmsMLUfree(pseq ->seq[i].Manufacturer); if (pseq ->seq[i].Model != NULL) cmsMLUfree(pseq ->seq[i].Model); if (pseq ->seq[i].Description != NULL) cmsMLUfree(pseq ->seq[i].Description); } + + _cmsFree(pseq ->ContextID, pseq ->seq); } - if (pseq ->seq != NULL) _cmsFree(pseq ->ContextID, pseq ->seq); _cmsFree(pseq -> ContextID, pseq); }