Fixed compiling with MSVC/C89
Don't free user managed msg when doing osd_exit during resize

Doing free'ing user managed msg will cause an double-free later. Also free'ing
messages without deleting them from the list will lead to bad reads after the
resize finished.
merged heads and simplified code