From 851583cff632c500e99457763aac35ae0280edea Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Sat, 5 Jan 2013 22:53:52 +0000 Subject: [PATCH] (2.7x qt) backport r13686 for #5192 --- NEWS | 1 + qt/prefs.cc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4b75b3af3..fd31f33c1 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ * Fix display of the torrent name in the Torrent Options dialog * Fix cursor point bug in the filterbar's entry field * Fix crash when adding a magnet link while Transmission was only visible in the system tray + * Fix free-memory-read error on shutdown ==== Daemon ==== * Better watchdir support * Documentation fixes in transmission-remote's manpage diff --git a/qt/prefs.cc b/qt/prefs.cc index cf2cc25fa..7e0609b30 100644 --- a/qt/prefs.cc +++ b/qt/prefs.cc @@ -220,7 +220,9 @@ Prefs :: ~Prefs( ) tr_bencDictAddStr( &top, key, val.value().name().toUtf8().constData() ); break; case QVariant::String: - { const char * s = val.toByteArray().constData(); + { + const QByteArray ba (val.toByteArray()); + const char * s = ba.constData(); if ( Utils::isValidUtf8( s ) ) tr_bencDictAddStr( &top, key, s ); else -- 2.49.0