aboutsummaryrefslogtreecommitdiff
path: root/backends/vkeybd
diff options
context:
space:
mode:
Diffstat (limited to 'backends/vkeybd')
-rw-r--r--backends/vkeybd/virtual-keyboard-parser.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp
index 5e4ce11fe4..58f0c468f6 100644
--- a/backends/vkeybd/virtual-keyboard-parser.cpp
+++ b/backends/vkeybd/virtual-keyboard-parser.cpp
@@ -205,6 +205,9 @@ bool VirtualKeyboardParser::parserCallback_event(ParserNode *node) {
evt->type = VirtualKeyboard::kVKEventModifier;
byte *flags = (byte*) malloc(sizeof(byte));
+ if (!flags)
+ error("[VirtualKeyboardParser::parserCallback_event] Cannot allocate memory");
+
*(flags) = parseFlags(node->values["modifiers"]);
evt->data = flags;
@@ -217,6 +220,9 @@ bool VirtualKeyboardParser::parserCallback_event(ParserNode *node) {
evt->type = VirtualKeyboard::kVKEventSwitchMode;
String& mode = node->values["mode"];
char *str = (char*) malloc(sizeof(char) * mode.size() + 1);
+ if (!str)
+ error("[VirtualKeyboardParser::parserCallback_event] Cannot allocate memory");
+
memcpy(str, mode.c_str(), sizeof(char) * mode.size());
str[mode.size()] = 0;
evt->data = str;