Fix an allocation error and many missing va_end() calls.
This addresses the following cppcheck reports:
[aslr/src/AslrMallocTest.cpp:160]: (error)
Allocation with malloc, printf doesn't release it.
[tests/jni/libjnitest/macroized_tests.c:195]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:298]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:401]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:504]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:607]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:710]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:813]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:916]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:1019]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:1122]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:1243]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/macroized_tests.c:1364]: (error)
va_list 'args' was opened but not closed by va_end().
[tests/jni/libjnitest/helper.c:73]: (error)
va_list 'args' was opened but not closed by va_end().
Change-Id: I8c93ce7d1445ec75ae9351be946e0ea19d5525c0
diff --git a/tests/aslr/src/AslrMallocTest.cpp b/tests/aslr/src/AslrMallocTest.cpp
index 6e773cb..91a36e2 100644
--- a/tests/aslr/src/AslrMallocTest.cpp
+++ b/tests/aslr/src/AslrMallocTest.cpp
@@ -157,7 +157,9 @@
return EXIT_FAILURE;
}
- printf("%p", malloc(size));
+ void* p = malloc(size);
+ printf("%p", p);
+ free(p);
return EXIT_SUCCESS;
}
#endif