Formatting .c/.h files and fix memory leakage issues
Signed-off-by: John Chung <john.chung@arm.com>
Change-Id: Id8328f412c2724992d80c0b3f895c8f85bc4ae68
diff --git a/generator/sections/gen-section-memory.c b/generator/sections/gen-section-memory.c
index 9d405a4..46eaed3 100644
--- a/generator/sections/gen-section-memory.c
+++ b/generator/sections/gen-section-memory.c
@@ -11,49 +11,49 @@
//Generates a single pseudo-random platform memory error section, saving the resulting address to the given
//location. Returns the size of the newly created section.
-size_t generate_section_memory(void** location)
+size_t generate_section_memory(void **location)
{
- //Create random bytes.
- int size = 80;
- UINT8* bytes = generate_random_bytes(size);
-
- //Set reserved areas to zero.
- UINT64* validation = (UINT64*)bytes;
- *validation &= 0x2FFFFF; //Validation 22-63
- *(bytes + 73) &= ~0b11100; //Extended bits 2-4
+ //Create random bytes.
+ int size = 80;
+ UINT8 *bytes = generate_random_bytes(size);
- //Fix values that could be above range.
- *(bytes + 72) = rand() % 16; //Memory error type
+ //Set reserved areas to zero.
+ UINT64 *validation = (UINT64 *)bytes;
+ *validation &= 0x2FFFFF; //Validation 22-63
+ *(bytes + 73) &= ~0x1C; //Extended bits 2-4
- //Fix error status.
- create_valid_error_section(bytes + 8);
+ //Fix values that could be above range.
+ *(bytes + 72) = rand() % 16; //Memory error type
- //Set return values, exit.
- *location = bytes;
- return size;
+ //Fix error status.
+ create_valid_error_section(bytes + 8);
+
+ //Set return values, exit.
+ *location = bytes;
+ return size;
}
//Generates a single pseudo-random memory 2 error section, saving the resulting address to the given
//location. Returns the size of the newly created section.
-size_t generate_section_memory2(void** location)
+size_t generate_section_memory2(void **location)
{
- //Create random bytes.
- int size = 96;
- UINT8* bytes = generate_random_bytes(size);
-
- //Set reserved areas to zero.
- UINT64* validation = (UINT64*)bytes;
- *validation &= 0x2FFFFF; //Validation 22-63
- *(bytes + 63) = 0; //Reserved byte 63
+ //Create random bytes.
+ int size = 96;
+ UINT8 *bytes = generate_random_bytes(size);
- //Fix values that could be above range.
- *(bytes + 61) = rand() % 16; //Memory error type
- *(bytes + 62) = rand() % 2; //Status
+ //Set reserved areas to zero.
+ UINT64 *validation = (UINT64 *)bytes;
+ *validation &= 0x2FFFFF; //Validation 22-63
+ *(bytes + 63) = 0; //Reserved byte 63
- //Fix error status.
- create_valid_error_section(bytes + 8);
+ //Fix values that could be above range.
+ *(bytes + 61) = rand() % 16; //Memory error type
+ *(bytes + 62) = rand() % 2; //Status
- //Set return values, exit.
- *location = bytes;
- return size;
-}
\ No newline at end of file
+ //Fix error status.
+ create_valid_error_section(bytes + 8);
+
+ //Set return values, exit.
+ *location = bytes;
+ return size;
+}