From: Richard Maciel <[email protected]> Related to coverity CID 10310.
rgbPublicKey member wasn't being released after the return of the function (success or failure paths). Signed-off-by: Richard Maciel <[email protected]> --- src/tcs/rpc/tcstp/rpc_key.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tcs/rpc/tcstp/rpc_key.c b/src/tcs/rpc/tcstp/rpc_key.c index 43d4bb8..144da83 100644 --- a/src/tcs/rpc/tcstp/rpc_key.c +++ b/src/tcs/rpc/tcstp/rpc_key.c @@ -430,7 +430,7 @@ tcs_wrap_KeyControlOwner(struct tcsd_thread_data *data) TCS_CONTEXT_HANDLE hContext; TCS_KEY_HANDLE hKey; UINT32 ulPublicKeyLength; - BYTE* rgbPublicKey; + BYTE* rgbPublicKey = NULL; UINT32 attribName; TSS_BOOL attribValue; TPM_AUTH ownerAuth; @@ -481,13 +481,18 @@ tcs_wrap_KeyControlOwner(struct tcsd_thread_data *data) if (result == TSS_SUCCESS) { initData(&data->comm, 2); - if (setData(TCSD_PACKET_TYPE_AUTH, 0, &ownerAuth, 0, &data->comm)) + if (setData(TCSD_PACKET_TYPE_AUTH, 0, &ownerAuth, 0, &data->comm)) { + free(rgbPublicKey); return TCSERR(TSS_E_INTERNAL_ERROR); - if (setData(TCSD_PACKET_TYPE_UUID, 1, &uuidData, 0, &data->comm)) + } + if (setData(TCSD_PACKET_TYPE_UUID, 1, &uuidData, 0, &data->comm)) { + free(rgbPublicKey); return TCSERR(TSS_E_INTERNAL_ERROR); + } } else done: initData(&data->comm, 0); + free(rgbPublicKey); data->comm.hdr.u.result = result; return TSS_SUCCESS; -- 1.8.5.3 ------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees _______________________________________________ TrouSerS-tech mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/trousers-tech
