projects
/
sdk
/
target
/
sdbd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
plugin: Fix Werrors caused by GCC-14.1.0 porting
[sdk/target/sdbd.git]
/
src
/
default_plugin_event.c
diff --git
a/src/default_plugin_event.c
b/src/default_plugin_event.c
index
787c3f4
..
37aa39a
100644
(file)
--- a/
src/default_plugin_event.c
+++ b/
src/default_plugin_event.c
@@
-120,6
+120,11
@@
int get_lock_state ( parameters* in, parameters* out )
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
+ if (out->array_of_parameter == NULL) {
+ out->number_of_parameter = 0;
+ PLUGIN_LOG("failed to allocate memory for the parameter\n");
+ return PLUGIN_CMD_FAIL;
+ }
out->array_of_parameter[0].type = type_int32;
out->array_of_parameter[0].v_int32 = ( plugin_pwlocked() == 1 ) ? PLUGIN_RET_ON : PLUGIN_RET_OFF;
out->array_of_parameter[0].type = type_int32;
out->array_of_parameter[0].v_int32 = ( plugin_pwlocked() == 1 ) ? PLUGIN_RET_ON : PLUGIN_RET_OFF;
@@
-132,8
+137,17
@@
static void pwlock_cb ( keynode_t *key, void* data )
int pwlocked = plugin_pwlocked();
parameters* out = ( parameters* ) malloc ( sizeof ( parameters ) );
int pwlocked = plugin_pwlocked();
parameters* out = ( parameters* ) malloc ( sizeof ( parameters ) );
+ if (out == NULL) {
+ PLUGIN_LOG("failed to allocate memory for the parameter\n");
+ return;
+ }
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
out->number_of_parameter = 1;
out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
+ if (out->array_of_parameter == NULL) {
+ PLUGIN_LOG("failed to allocate memory for the parameter\n");
+ free(out);
+ return;
+ }
out->array_of_parameter[0].type = type_int32;
out->array_of_parameter[0].v_int32 = ( pwlocked == 1 ) ? PLUGIN_RET_ON : PLUGIN_RET_OFF;
out->array_of_parameter[0].type = type_int32;
out->array_of_parameter[0].v_int32 = ( pwlocked == 1 ) ? PLUGIN_RET_ON : PLUGIN_RET_OFF;