diff --git a/examples/libtest/libtest.c b/examples/libtest/libtest.c index d9d3670b78..8336058843 100644 --- a/examples/libtest/libtest.c +++ b/examples/libtest/libtest.c @@ -22,8 +22,9 @@ * Included Files ****************************************************************************/ -#include +#include #include +#include /**************************************************************************** * Public Functions @@ -35,5 +36,16 @@ void library_test(void) { + FAR int *p = malloc(sizeof(int)); + if (p == NULL) + { + printf("libtest failed to allocate memory\n"); + return; + } + + *p = 12345; + printf("libtest: p=%p *p=%d\n", p, *p); + free(p); + printf("Hello, Library!!\n"); } diff --git a/examples/libtest/libtest_main.c b/examples/libtest/libtest_main.c index 25b30b5a38..60281a4705 100644 --- a/examples/libtest/libtest_main.c +++ b/examples/libtest/libtest_main.c @@ -22,8 +22,7 @@ * Included Files ****************************************************************************/ -#include -#include +#include #include "libtest.h" /****************************************************************************