Running under valgrind, open LyX (master branch), create a new document, write 'a', select it and copy it; valgrind complains (see below). I get it consistently.
A second copy doesn't give any problem, it's just the first one that does. The problem seems related to a badly initialized temporary buffer (maybe). The problem is not present in 2.0.6. I got this while trying to investigate #9302, don't know if it is related though. A/ ==8953== Invalid read of size 1 ==8953== at 0x53353B: lyx::(anonymous namespace)::pasteSelectionHelper(lyx::DocIterator const&, lyx::ParagraphList const&, std::tr1::shared_ptr<lyx::DocumentClass const>, lyx::Buffer*, lyx::ErrorList&) (CutAndPaste.cpp:144) ==8953== by 0x538398: lyx::(anonymous namespace)::putClipboard(lyx::ParagraphList const&, std::tr1::shared_ptr<lyx::DocumentClass const>, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) (CutAndPaste.cpp:512) ==8953== by 0x53965D: lyx::cap::copySelection(lyx::Cursor const&, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) (CutAndPaste.cpp:1007) ==8953== by 0x539724: lyx::cap::copySelection(lyx::Cursor const&) (CutAndPaste.cpp:908) ==8953== by 0x67A6DB: lyx::Text::dispatch(lyx::Cursor&, lyx::FuncRequest&) (Text3.cpp:1310) ==8953== by 0x91D230: lyx::InsetText::doDispatch(lyx::Cursor&, lyx::FuncRequest&) (InsetText.cpp:312) ==8953== by 0x817CCA: lyx::Inset::dispatch(lyx::Cursor&, lyx::FuncRequest&) (Inset.cpp:319) ==8953== by 0x52AC92: lyx::Cursor::dispatch(lyx::FuncRequest const&) (Cursor.cpp:399) ==8953== by 0x9778A5: lyx::frontend::GuiView::dispatchToBufferView(lyx::FuncRequest const&, lyx::DispatchResult&) (GuiView.cpp:3295) ==8953== by 0x98F670: lyx::frontend::GuiView::dispatch(lyx::FuncRequest const&, lyx::DispatchResult&) (GuiView.cpp:3844) ==8953== by 0x95C409: lyx::frontend::GuiApplication::dispatch(lyx::FuncRequest const&, lyx::DispatchResult&) (GuiApplication.cpp:1982) ==8953== by 0x94D19E: lyx::frontend::GuiApplication::dispatch(lyx::FuncRequest const&) (GuiApplication.cpp:1332) ==8953== Address 0x17cbe996 is 390 bytes inside a block of size 984 free'd