Don't leak newTemplate in pk11_copyAttributes()

Cherry-pick of NSS fix from 3.37
This commit is contained in:
wolfbeast 2018-07-01 16:31:31 +02:00 • committed by Roy Tam
commit 1ed60ee41b

View file

@ -88,6 +88,7 @@ pk11_copyAttributes(PLArenaPool *arena,
} }
if (crv != CKR_OK) { if (crv != CKR_OK) {
PORT_SetError(PK11_MapError(crv)); PORT_SetError(PK11_MapError(crv));
PORT_Free(newTemplate);
return SECFailure; return SECFailure;
} }
if (targetID == CK_INVALID_HANDLE) { if (targetID == CK_INVALID_HANDLE) {
@ -100,7 +101,7 @@ pk11_copyAttributes(PLArenaPool *arena,
copyTemplate, copyTemplateCount); copyTemplate, copyTemplateCount);
} }
if (newTemplate) { if (newTemplate) {
free(newTemplate); PORT_Free(newTemplate);
} }
return rv; return rv;
} }