if (rep.success) {
*len = rep.valueLen;
*value = (char*) Xmalloc (*len+1);
+ if (!*value) {
+ _XEatData(dpy, (*len+1)&~1);
+ return False;
+ }
_XReadPad(dpy, *value, *len);
(*value)[*len] = 0;
}
}
if (rep.success) {
desc = (char*)Xmalloc(rep.descLen+1);
+ if (!*desc) {
+ _XEatData(dpy, (rep.descLen+1)&~1);
+ return False;
+ }
_XReadPad(dpy, desc, rep.descLen);
desc[rep.descLen] = 0;
}
SyncHandle();
*len = rep.textLen;
*str = (char*) Xmalloc (*len+1);
+ if (!*str) {
+ _XEatData(dpy, (*len+1)&~1);
+ return False;
+ }
_XReadPad(dpy, *str, *len);
(*str)[*len] = 0;
return True;
SyncHandle();
*addr = Xmalloc(rep.addrLen+1);
+ *user = Xmalloc(rep.userLen+1);
+ if (!*addr || !*user) {
+ Xfree(*addr);
+ Xfree(*user);
+ _XEatData(dpy, (rep.addrLen+1)&~1 + (rep.userLen+1)&~1);
+ return False;
+ }
_XReadPad(dpy, *addr, rep.addrLen);
(*addr)[rep.addrLen] = 0;
- *user = Xmalloc(rep.userLen+1);
_XReadPad(dpy, *user, rep.userLen);
(*user)[rep.userLen] = 0;
*timeout = rep.timeout;
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'",