Fix memory leak in semaphore_test_02.
Use valgrind tool (http://valgrind.org/) to check the memory leak problem. Now the valgrind can be compiled on the following platforms: X86/Linux, AMD64/Linux, PPC32/Linux, PPC64/Linux.
=================
Before patching
=================
# valgrind --leak-check=full --show-reachable=yes ./semaphore_test_02
.................
==28763== LEAK SUMMARY:
==28763==    definitely lost: 80 bytes in 1 blocks.
==28763==      possibly lost: 0 bytes in 0 blocks.
==28763==    still reachable: 384 bytes in 1 blocks.
==28763==         suppressed: 0 bytes in 0 blocks.
=================
After patching
=================
# valgrind --leak-check=full --show-reachable=yes ./semaphore_test_02
.......................
==1372== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 3 from 1)
==1372== malloc/free: in use at exit: 0 bytes in 0 blocks.
==1372== malloc/free: 2 allocs, 2 frees, 464 bytes allocated.
==1372== For counts of detected errors, rerun with: -v
==1372== All heap blocks were freed -- no leaks are possible.
Signed-off-by: Jin Bing Guo <guojb@cn.ibm.com>
1 file changed