From: Richard Maciel <[email protected]>

Related to coverity CID: 10290

pAuth variable could set to NULL in some cases, which, when passed
to the aforementioned function would result in a dereference of NULL.

Signed-off-by: Richard Maciel <[email protected]>
---
 src/tcs/rpc/tcstp/rpc_nv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/tcs/rpc/tcstp/rpc_nv.c b/src/tcs/rpc/tcstp/rpc_nv.c
index a44f51a..a54fb48 100644
--- a/src/tcs/rpc/tcstp/rpc_nv.c
+++ b/src/tcs/rpc/tcstp/rpc_nv.c
@@ -189,9 +189,10 @@ tcs_wrap_NV_WriteValueAuth(struct tcsd_thread_data *data)
                free(rgbDataToWrite);
                return TCSERR(TSS_E_INTERNAL_ERROR);
        }
-       if (getData(TCSD_PACKET_TYPE_AUTH, 5, &Auth, 0, &data->comm))
-               pAuth = NULL;
-       else
+       if (getData(TCSD_PACKET_TYPE_AUTH, 5, &Auth, 0, &data->comm)) {
+               free(rgbDataToWrite);
+               return TCSERR(TSS_E_INTERNAL_ERROR);
+       } else
                pAuth = &Auth;
 
        MUTEX_LOCK(tcsp_lock);
-- 
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

Reply via email to