xclip
xclip copied to clipboard
fix segfault on conversion error
When I copy some text from a github commit inside Chrome,
the selection cannot be converted to text.
When I run xclip -o with that selection in the paste buffer,
I get a segmentation fault because free is being called with
an invalid argument (presumably because xcout isn't setting the
sel_buf pointer correctly on error).
% xclip -o
1587474: signal: sys: segmentation violation (core dumped)
To fix this, remove the call to free in the error case, as it isn't really necessary
anyway as the program is about to exit.
When the free call is removed, xclip prints this error instead of seg-faulting:
xclip: Error: 'Chromium clipboard' (0x1c00024) cannot convert PRIMARY selection to target 'STRING'