Initialize shared->buffer with NULL 61/167261/1
authorKrzysztof Dynowski <k.dynowski@samsung.com>
Tue, 16 Jan 2018 11:30:17 +0000 (12:30 +0100)
committerKrzysztof Dynowski <k.dynowski@samsung.com>
Tue, 16 Jan 2018 11:31:58 +0000 (12:31 +0100)
Change-Id: Ia6bf28f88d9ec05cfdb941f82687f9d061312b1e

TEECLib/src/teec_api.c

index 085f57a..813f46d 100644 (file)
@@ -864,6 +864,10 @@ TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
        TEEC_ContextImp *context_imp;
        RegSharedMemData regmem;
 
+       if (sharedMem) {
+               sharedMem->buffer = NULL;
+       }
+
        // Check if the Context is valid
        if (!context) {
                LOGE(TEEC_LIB, "context is NULL");
@@ -921,7 +925,6 @@ TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
                return TEE_ERROR_OUT_OF_MEMORY;
 
        TEEC_SharedMemoryImp *sharedMem_imp = (TEEC_SharedMemoryImp *)sharedMem->imp;
-       sharedMem->buffer = NULL;
        sharedMem_imp->context = context;
 
        /* Allocate shared memory and get the Shared Memory key to be shared with