Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 021d2359 authored by Scott Wheeler's avatar Scott Wheeler

Fixed memory leaks related to assigning a char * to a QString while reading

tag information.

svn path=/trunk/kdemultimedia/juk/; revision=143614
parent c3d95145
......@@ -44,15 +44,52 @@ Tag::Tag(QString file)
// the easy ones -- these are supported in the id3 class
///////////////////////////////////////////////////////////
artistName = ID3_GetArtist(&tag);
albumName = ID3_GetAlbum(&tag);
trackName = ID3_GetTitle(&tag);
char *temp;
temp = ID3_GetArtist(&tag);
artistName = temp;
delete [] temp;
temp = ID3_GetAlbum(&tag);
albumName = temp;
delete [] temp;
temp = ID3_GetTitle(&tag);
trackName = temp;
delete [] temp;
temp = ID3_GetTrack(&tag);
trackNumberString = temp;
delete [] temp;
trackNumber = ID3_GetTrackNum(&tag);
trackNumberString = ID3_GetTrack(&tag);
comment = ID3_GetComment(&tag);
genre = ID3_GetGenre(&tag);
temp = ID3_GetComment(&tag);
comment = temp;
delete [] temp;
temp = ID3_GetGenre(&tag);
genre = temp;
delete [] temp;
genre.setId3v1(int(ID3_GetGenreNum(&tag)));
yearString = ID3_GetYear(&tag);
temp = ID3_GetYear(&tag);
yearString = temp;
delete [] temp;
// changed from the below scheme because of memory leaks
/*
artistName = ID3_GetArtist(&tag);
albumName = ID3_GetAlbum(&tag);
trackName = ID3_GetTitle(&tag);
trackNumberString = ID3_GetTrack(&tag);
trackNumber = ID3_GetTrackNum(&tag);
comment = ID3_GetComment(&tag);
genre = ID3_GetGenre(&tag);
genre.setId3v1(int(ID3_GetGenreNum(&tag)));
yearString = ID3_GetYear(&tag);
*/
hasTagBool = (tag.HasV2Tag() || tag.HasV1Tag());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment