[vlc-devel] [PATCH] Fixes occasional corruption =?iso-8859-1?q?of=09?="equalizer-bands"

Francois Cartegnie fcvlcdev at free.fr
Fri Jun 17 22:40:21 CEST 2011


Le vendredi 17 juin 2011, Laurent Aimar a écrit :

> > +    std::string s = values.toStdString();
> > +    const char *psz_values=s.c_str();

> > +    return strdup( psz_values );
> 
>  I don't think this one is needed as the temporary object is only destroy
> at the end of the scope (ie when strdup() has returned).

QString -> QByteArray -> char * -> std::s -> char *...

Don't use char* at all and just return the QString.
QString Equalizer::createValuesFromPreset( int )


And as QByteArray always return a valid pointer( NULL != "\0" ), it
breaks code later:
1079     char *psz_values = createValuesFromPreset( i_preset );
1080     if( !psz_values ) return ;


Francois



More information about the vlc-devel mailing list