Skip to content

Commit

Permalink
Free es10cex allocated memory (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
damonto authored Jan 10, 2024
1 parent ff6c5f3 commit 3c881ee
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 44 additions & 0 deletions euicc/es10cex.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,48 @@ int es10cex_get_euiccinfo2(struct euicc_ctx *ctx, struct es10cex_euiccinfo2 **al

void es10cex_free_euiccinfo2(struct es10cex_euiccinfo2 *info)
{
if (info->euiccCiPKIdListForVerification)
{
for (int i = 0; info->euiccCiPKIdListForVerification[i] != NULL; i++)
{
free(info->euiccCiPKIdListForVerification[i]);
}
free(info->euiccCiPKIdListForVerification);
}

if (info->euiccCiPKIdListForSigning)
{
for (int i = 0; info->euiccCiPKIdListForSigning[i] != NULL; i++)
{
free(info->euiccCiPKIdListForSigning[i]);
}
free(info->euiccCiPKIdListForSigning);
}

if (info->uiccCapability)
{
free(info->uiccCapability);
}

if (info->rspCapability)
{
free(info->rspCapability);
}

if (info->forbiddenProfilePolicyRules)
{
free(info->forbiddenProfilePolicyRules);
}

if (info->certificationDataObject.discoveryBaseURL)
{
free(info->certificationDataObject.discoveryBaseURL);
}

if (info->certificationDataObject.platformLabel)
{
free(info->certificationDataObject.platformLabel);
}

free(info);
}
2 changes: 1 addition & 1 deletion src/applet/chip/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static int applet_main(int argc, char **argv)
jprint_success(jdata);

free(eid);
// es10cex_free_euiccinfo2(&euiccinfo2);
es10cex_free_euiccinfo2(euiccinfo2);

return 0;
}
Expand Down

0 comments on commit 3c881ee

Please sign in to comment.