free memories that are bound to the context
authorSansar Choinyambuu <schoinya@hsr.ch>
Fri, 28 Oct 2011 14:45:45 +0000 (16:45 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 28 Nov 2011 13:39:52 +0000 (14:39 +0100)
src/libpts/pts/pts.c

index 18a64de..df84e1c 100644 (file)
@@ -733,8 +733,8 @@ METHOD(pts_t, read_pcr, bool,
        *output = chunk_clone(*output);
 
        chunk_clear(&pcr_value);
-       Tspi_Context_Close(hContext);
        DBG3(DBG_PTS, "PCR %d value:%B", pcr_num, output);
+       Tspi_Context_Close(hContext);
        return TRUE;
 
        err:
@@ -1330,11 +1330,14 @@ static bool has_tpm(private_pts_t *this)
                goto err;
        }
        this->tpm_version_info = chunk_clone(this->tpm_version_info);
+       
+       Tspi_Context_FreeMemory(hContext, NULL);
        Tspi_Context_Close(hContext);
        return TRUE;
 
        err:
        DBG1(DBG_PTS, "TPM not available: tss error 0x%x", result);
+       Tspi_Context_FreeMemory(hContext, NULL);
        Tspi_Context_Close(hContext);
        return FALSE;
 }