Call TEE_CreatePersistentObject() with a valid pointer

According to GP specification, passing a NULL pointer to
TEE_OpenPersistentObject() and TEE_CreatePersistentObject()
should panic the trusted application.
Current code is using a NULL pointer and expects success.
After creation (and opening) of the new object,
it should also be closed: we cannot expect to do anything on it.

Signed-off-by: Cedric Auger <cedric.auger@provenrun.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
diff --git a/ta/storage/storage.c b/ta/storage/storage.c
index 6a8e49b..e0e66b4 100644
--- a/ta/storage/storage.c
+++ b/ta/storage/storage.c
@@ -131,6 +131,7 @@
 					   TEE_Param params[4])
 {
 	TEE_Result res = TEE_ERROR_GENERIC;
+	TEE_ObjectHandle o = TEE_HANDLE_NULL;
 	void *object_id = NULL;
 
 	ASSERT_PARAM_TYPE(TEE_PARAM_TYPES
@@ -158,7 +159,8 @@
 	res = TEE_CreatePersistentObject(params[1].value.a,
 					 object_id, params[0].memref.size,
 					 TEE_DATA_FLAG_OVERWRITE,
-					 NULL, NULL, 0, NULL);
+					 NULL, NULL, 0, &o);
+	TEE_CloseObject(o);
 
 	if (command == TA_STORAGE_CMD_CREATE_OVERWRITE)
 		TEE_Free(object_id);