aboutsummaryrefslogtreecommitdiffstats
path: root/unix/vncconfig/vncconfig.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-10-10 13:32:31 +0200
committerPierre Ossman <ossman@cendio.se>2014-10-10 13:32:31 +0200
commite83b14a0e01fc7563372bf9571973e7c613941a0 (patch)
tree0eca9cbe86762f41fe1cd342238d355aa1d83ea5 /unix/vncconfig/vncconfig.cxx
parent3b07fc126399f562e07643d8a3e9ce81a3b2185e (diff)
downloadtigervnc-e83b14a0e01fc7563372bf9571973e7c613941a0.tar.gz
tigervnc-e83b14a0e01fc7563372bf9571973e7c613941a0.zip
Make sure we check failed memory allocations
Diffstat (limited to 'unix/vncconfig/vncconfig.cxx')
-rw-r--r--unix/vncconfig/vncconfig.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/unix/vncconfig/vncconfig.cxx b/unix/vncconfig/vncconfig.cxx
index f70cc714..bffdfbe2 100644
--- a/unix/vncconfig/vncconfig.cxx
+++ b/unix/vncconfig/vncconfig.cxx
@@ -215,6 +215,10 @@ public:
if (cutText)
XFree(cutText);
cutText = (char*)malloc(nitems); // assuming XFree() same as free()
+ if (!cutText) {
+ vlog.error("unable to allocate selection buffer");
+ return;
+ }
memcpy(cutText, data, nitems);
cutTextLen = nitems;
vlog.debug("sending %s selection as server cut text: '%.*s%s'",