# HG changeset patch # User Eli Zaretskii # Date 1220099536 0 # Node ID 455b25c4ebc2ce005e5cec3d0655637b4da2ccb8 # Parent 63c917af418bbc452b93a4591079f828df785b3c (Fw16_set_clipboard_data): Don't encode text if clipboard is unavailable. Set dst to NULL if it doesn't point to malloc'ed data. (Fw16_get_clipboard_data): Initialize htext to NULL, to avoid passing random values to xfree. diff -r 63c917af418b -r 455b25c4ebc2 src/w16select.c --- a/src/w16select.c Sat Aug 30 12:15:06 2008 +0000 +++ b/src/w16select.c Sat Aug 30 12:32:16 2008 +0000 @@ -500,6 +500,9 @@ BLOCK_INPUT; + if (!open_clipboard ()) + goto error; + nbytes = SBYTES (string); src = SDATA (string); @@ -515,6 +518,7 @@ will have to convert it to DOS CR-LF style. */ no_crlf_conversion = 0; Vlast_coding_system_used = Qraw_text; + dst = NULL; /* so we don't try to free a random pointer */ } else { @@ -541,9 +545,6 @@ src = dst; } - if (!open_clipboard ()) - goto error; - ok = empty_clipboard () && ((put_status = set_clipboard_data (CF_OEMTEXT, src, nbytes, no_crlf_conversion)) @@ -595,7 +596,7 @@ Lisp_Object frame; { unsigned data_size, truelen; - unsigned char *htext; + unsigned char *htext = NULL; Lisp_Object ret = Qnil; int no_crlf_conversion, require_decoding = 0;