mitchell at kde.org
Fri Mar 20 13:00:35 CET 2009
If any of you guys can see what might be going wrong here, please let me
know. The crash takes place in the destructor of a KEncodingProber
object allocated on the stack, in the line "delete encoding". Here are
the places "encoding" is used:
In declaration of KEncodingProberPrivate:
const char * encoding;
KEncodingProberPrivate(): encoding(strdup("")) ......
In destructor of KEncodingProberPrivate:
delete encoding; <- crash
In function KEncodingProberPrivate::unicodeTest:
encoding = "UTF-8";
encoding = "ISO-10646-UCS-4";
(a few other similar assignments...these all depend on the cases in a
...(then, later in the same function)...
if (encoding && strlen(encoding))
I've gone through the code and ensured that encoding is only ever
deleted in the private class destructor, so it's not a double free. One
thing I noticed is that it's a const char pointer, and most of those
assignments it is being assigned to pre-defined character strings,
except for the initialization which is setting it to a strdup. If
nothing else, that could end up being a memory leak if it eventually is
assigned to a different string and that original strdup-provided string
goes into the ether. But that shouldn't cause a crash.
Anyone have ideas?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://mail.kde.org/pipermail/amarok-devel/attachments/20090320/a94e2ace/attachment.sig
More information about the Amarok-devel