From a9731b90f6c5469449dd33085f76aae1bae3fc78 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Fri, 17 Jul 2020 09:12:54 +0200 Subject: [PATCH] Don't freeze the shell when we are out of memory --- modules/database/src/ioc/db/dbTest.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/database/src/ioc/db/dbTest.c b/modules/database/src/ioc/db/dbTest.c index 25782a243..a312abbf7 100644 --- a/modules/database/src/ioc/db/dbTest.c +++ b/modules/database/src/ioc/db/dbTest.c @@ -395,7 +395,11 @@ long dbpf(const char *pname,const char *pvalue) } } p = pvalue; - array = dbCalloc(n, MAX_STRING_SIZE); + array = calloc(n, MAX_STRING_SIZE); + if (!array) { + printf("Out of memory\n"); + return -1; + } for (n = 0; *p && n < addr.no_elements; n++) { char* c = &array[n*MAX_STRING_SIZE]; while (isspace(*p)) p++;