You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2022/07/23 19:58:10 UTC
[incubator-nuttx-apps] 07/20: uorb_unit_test: optimize stack used
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit d44dd1c42661fae46cc32f3dd83d05a831018d00
Author: Jiuzhu Dong <do...@xiaomi.com>
AuthorDate: Sat Apr 16 18:24:02 2022 +0800
uorb_unit_test: optimize stack used
Signed-off-by: Jiuzhu Dong <do...@xiaomi.com>
---
system/uorb/test/unit_test.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/system/uorb/test/unit_test.c b/system/uorb/test/unit_test.c
index 0aaa0a1b7..2ae6f88a3 100644
--- a/system/uorb/test/unit_test.c
+++ b/system/uorb/test/unit_test.c
@@ -61,11 +61,17 @@ static int pubsubtest_thread_entry(int argc, FAR char *argv[])
int current_value;
int num_missed = 0;
unsigned timingsgroup = 0;
- unsigned timings[MAX_RUNS];
+ FAR unsigned *timings;
unsigned timing_min = 9999999;
unsigned timing_max = 0;
unsigned i;
+ timings = malloc(MAX_RUNS * sizeof(unsigned));
+ if (timings == NULL)
+ {
+ return -ENOMEM;
+ }
+
/* clear all ready flags */
test_multi_sub = orb_subscribe_multi(ORB_ID(orb_test_medium), 0);
@@ -128,6 +134,7 @@ static int pubsubtest_thread_entry(int argc, FAR char *argv[])
if (f == NULL)
{
snerr("Error opening file!");
+ free(timings);
return ERROR;
}
@@ -167,6 +174,7 @@ static int pubsubtest_thread_entry(int argc, FAR char *argv[])
g_pubsubtest_res = OK;
}
+ free(timings);
return g_pubsubtest_res;
}