[prev in list] [next in list] [prev in thread] [next in thread]
List: trousers-tech
Subject: Re: [TrouSerS-tech] [PATCH 08/17] Fixed memory leak in tcs_wrap_KeyControlOwner
From: "Fuchs, Andreas" <andreas.fuchs () sit ! fraunhofer ! de>
Date: 2014-04-11 9:47:57
Message-ID: 1397209677.15139.32.camel () pc-fuchslap2 ! sit ! fraunhofer ! de
[Download RAW message or body]
Disclaimer:
I could not complie-test or runtime-test these patches right now. This is a pure \
code-only review of the patches.
Looks good to me.
Am Mittwoch, den 09.04.2014, 15:41 -0300 schrieb rmaciel@linux.vnet.ibm.com:
> From: Richard Maciel <rmaciel@linux.vnet.ibm.com>
>
> 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 <rmaciel@linux.vnet.ibm.com>
> ---
> 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;
>
------------------------------------------------------------------------------
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
TrouSerS-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/trousers-tech
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic