[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdebase/workspace/powerdevil/kcmodule
From:       André_Wöbbeking <Woebbeking () kde ! org>
Date:       2008-09-16 16:37:18
Message-ID: 200809161837.29462.Woebbeking () kde ! org
[Download RAW message or body]

On Tuesday 16 September 2008, Dario Freddi wrote:
> SVN commit 861463 by dafre:
>
> Better naming, and avoiding memleaks
>
>
>  M  +6 -3      EditPage.cpp
>
>
> --- trunk/KDE/kdebase/workspace/powerdevil/kcmodule/EditPage.cpp
> #861462:861463 @@ -477,10 +477,13 @@
>      KConfig *toImport = new KConfig( fileName, KConfig::SimpleConfig
> );
>
>      foreach(const QString &ent, toImport->groupList()) {
> -        KConfigGroup *group = new KConfigGroup(toImport, ent);
> -        KConfigGroup *group2 = new KConfigGroup(m_profilesConfig,
> ent); +        KConfigGroup *copyFrom = new KConfigGroup(toImport,
> ent); +        KConfigGroup *copyTo = new
> KConfigGroup(m_profilesConfig, ent);
>
> -        group->copyTo(group2);
> +        copyFrom->copyTo(copyTo);
> +
> +        delete copyFrom;
> +        delete copyTo;

Why do you create them on the heap at all instead of using the stack?
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic