Formatting .c/.h files and fix memory leakage issues

Signed-off-by: John Chung <john.chung@arm.com>
Change-Id: Id8328f412c2724992d80c0b3f895c8f85bc4ae68
diff --git a/tests/test-utils.cpp b/tests/test-utils.cpp
index 87cd429..c12e335 100644
--- a/tests/test-utils.cpp
+++ b/tests/test-utils.cpp
@@ -4,8 +4,8 @@
  * Author: Lawrence.Tang@arm.com
  **/
 
-#include <stdio.h>
-#include <stdlib.h>
+#include <cstdio>
+#include <cstdlib>
 #include "test-utils.hpp"
 extern "C" {
 #include "../edk/BaseTypes.h"
@@ -14,18 +14,22 @@
 
 //Returns a ready-for-use memory stream containing a CPER record with the given sections inside.
 FILE *generate_record_memstream(const char **types, UINT16 num_types,
-				char **buf, size_t *buf_size, int single_section)
+				char **buf, size_t *buf_size,
+				int single_section)
 {
 	//Open a memory stream.
 	FILE *stream = open_memstream(buf, buf_size);
 
 	//Generate a section to the stream, close & return.
-	if (!single_section)
-		generate_cper_record((char **)types, num_types, stream);
-	else
-		generate_single_section_record((char*)types[0], stream);
+	if (!single_section) {
+		generate_cper_record(const_cast<char **>(types), num_types,
+				     stream);
+	} else {
+		generate_single_section_record(const_cast<char *>(types[0]),
+					       stream);
+	}
 	fclose(stream);
 
 	//Return fmemopen() buffer for reading.
 	return fmemopen(*buf, *buf_size, "r");
-}
\ No newline at end of file
+}