summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzack leung <zakthertemsdev@gmail.com>2021-10-18 23:46:10 +0000
committerJoel Sherrill <joel@rtems.org>2021-11-03 08:39:12 -0500
commit19c101281a4371909901b5d6ed26cba7296ce21c (patch)
tree3af906a52a676ac2c47117939ed1bcb74bb7f305
parenta857a225d06b9090b0386934551392af073c731e (diff)
downloadrtems-19c101281a4371909901b5d6ed26cba7296ce21c.tar.bz2
libtests/calloc.c: Fix reported memory leak
This fix came from Code Inspector, flagged by one of the analysis that was done. This test code is compiled only but better to address the issues so future static analysis reports will not include it.
-rw-r--r--testsuites/libtests/POSIX/calloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/testsuites/libtests/POSIX/calloc.c b/testsuites/libtests/POSIX/calloc.c
index bd04faa800..a7537c8cc4 100644
--- a/testsuites/libtests/POSIX/calloc.c
+++ b/testsuites/libtests/POSIX/calloc.c
@@ -16,6 +16,8 @@ int
main (void)
{
void *foo = calloc (42, 43);
+ int rc = (foo != NULL);
+ free(foo);
- return (foo != NULL);
+ return rc;
}