48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
|
|
From 3ccbc99a1bf6b2da543c9db9ac03aca2019fc50f Mon Sep 17 00:00:00 2001
|
||
|
|
From: Cropi <alakatos@redhat.com>
|
||
|
|
Date: Wed, 25 Sep 2024 10:32:49 +0200
|
||
|
|
Subject: [PATCH] rainerscript: do not try to call a function if it does not
|
||
|
|
exist
|
||
|
|
|
||
|
|
---
|
||
|
|
grammar/rainerscript.c | 9 ++-------
|
||
|
|
1 file changed, 2 insertions(+), 7 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
|
||
|
|
index 69d0b38ba..db7edbb1e 100644
|
||
|
|
--- a/grammar/rainerscript.c
|
||
|
|
+++ b/grammar/rainerscript.c
|
||
|
|
@@ -2901,11 +2901,6 @@ doFuncCall(struct cnffunc *__restrict__ const func, struct svar *__restrict__ co
|
||
|
|
free(fname);
|
||
|
|
}
|
||
|
|
if(func->fPtr == NULL) {
|
||
|
|
- char *fname = es_str2cstr(func->fname, NULL);
|
||
|
|
- LogError(0, RS_RET_INTERNAL_ERROR,
|
||
|
|
- "rainerscript: internal error: NULL pointer for function named '%s'\n",
|
||
|
|
- fname);
|
||
|
|
- free(fname);
|
||
|
|
ret->datatype = 'N';
|
||
|
|
ret->d.n = 0;
|
||
|
|
} else {
|
||
|
|
@@ -3802,7 +3797,7 @@ cnffuncDestruct(struct cnffunc *func)
|
||
|
|
char *cstr = es_str2cstr(func->fname, NULL);
|
||
|
|
struct scriptFunct *foundFunc = searchModList(cstr);
|
||
|
|
free(cstr);
|
||
|
|
- if(foundFunc->destruct != NULL) {
|
||
|
|
+ if(foundFunc && foundFunc->destruct != NULL) {
|
||
|
|
foundFunc->destruct(func);
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -5300,7 +5295,7 @@ cnffuncNew(es_str_t *fname, struct cnffparamlst* paramlst)
|
||
|
|
}
|
||
|
|
/* some functions require special initialization */
|
||
|
|
struct scriptFunct *foundFunc = searchModList(cstr);
|
||
|
|
- if(foundFunc->initFunc != NULL) {
|
||
|
|
+ if(foundFunc && foundFunc->initFunc != NULL) {
|
||
|
|
foundFunc->initFunc(func);
|
||
|
|
}
|
||
|
|
free(cstr);
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|