src/util-lua-flowvarlib.c:110:12: warning: If memory allocation fails, then there is a possible null pointer dereference: buf [nullPointerOutOfMemory]
memcpy(buf, value, len);
^
src/util-lua-flowvarlib.c:109:28: note: Assuming allocation function fails
uint8_t *buf = SCMalloc(len + 1);
^
src/util-lua-flowvarlib.c:109:28: note: Assignment 'buf=malloc(len+1)', assigned value is 0
uint8_t *buf = SCMalloc(len + 1);
^
src/util-lua-flowvarlib.c:110:12: note: Null pointer dereference
memcpy(buf, value, len);
^
src/util-lua-flowvarlib.c:111:5: warning: If memory allocation fails, then there is a possible null pointer dereference: buf [nullPointerOutOfMemory]
buf[len] = '\0';
^
src/util-lua-flowvarlib.c:109:28: note: Assuming allocation function fails
uint8_t *buf = SCMalloc(len + 1);
^
src/util-lua-flowvarlib.c:109:28: note: Assignment 'buf=malloc(len+1)', assigned value is 0
uint8_t *buf = SCMalloc(len + 1);
^
src/util-lua-flowvarlib.c:111:5: note: Null pointer dereference
buf[len] = '\0';
}
uint8_t *buf = SCMalloc(len + 1);
+ if (buf == NULL) {
+ return luaL_error(L, "alloc failure");
+ }
memcpy(buf, value, len);
buf[len] = '\0';
FlowVarAddIdValue(f, *flowvar_id, buf, (uint16_t)len);