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

List:       kde-commits
Subject:    Re: kdenetwork/kppp
From:       "Aaron J. Seigo" <aseigo () olympusproject ! org>
Date:       2002-09-28 12:20:42
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 28 September 2002 06:36, Harri Porten wrote:
> On Sat, 28 Sep 2002, Aaron J.Seigo wrote:
> > Modified Files:
> >          modem.cpp modemdb.cpp providerdb.cpp
> > Log Message:
> > kill a couple of memory leaks. someone with a modem really needs to
> > valgrind kppp (i don't have a modem), because i caught these just by
> > visually inspecting the code (which i'm not familiar with) for about half
> > an hour or so. i'd wager valgrind is a bit better memory profiler than
> > my tired eyes are =)
>
> The modem.cpp fix looks good, the one in providerdb.cpp is a neutral
> cleanup but the modemdb.cpp change looks dangerous !
>
> -    CharDict *c = new CharDict;
> -    c->setAutoDelete(true);
> -    loadModem(*it, *c);
> +    CharDict c;
> +    c.setAutoDelete(true);
> +    loadModem(*it, c);
> [....]
> -    modems.append(c);
> +    modems.append(&c);
>
> Are you aware of the fact that there is a
>
>      modems.setAutoDelete(true);
>
> statement further above ?

indeed.. my bad, fixed now...

> Be careful when fixing leaks when being tired :)

apologies. speaking of which, these are the other new()s that caught my 
attention but which i was too tired to investigate:

connect.cpp:*     termwindow = new LoginTerm(0L, 0L);
kpppwidget.cpp:  (void)new Modem;
kpppwidget.cpp:  con_win = new ConWindow(0, "conw", this, stats);
kpppwidget.cpp:  statdlg = new PPPStatsDlg(0, "stats", this, stats);
kpppwidget.cpp:  debugwindow = new DebugWidget(0,"debugwindow");
kpppwidget.cpp:  con = new ConnectWidget(0, "con", stats);
kpppwidget.cpp:    acct = new Accounting(this, stats);
main.cpp:    (void) new Opener(sockets[1]);
main.cpp:  (void) new Requester(sockets[0]);
main.cpp:  (void)new DockWidget(p_kppp->con_win, "dockw", p_kppp->stats);
modem.cpp:      sn = new QSocketNotifier(modemfd, QSocketNotifier::Read, 
this);

some of these stick around for the lifetime of the program, so shouldn't be an 
issue, though i'm not sure if the dtors are important... 

- -- 
Aaron J. Seigo
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

"Everything should be made as simple as possible, but not simpler"
    - Albert Einstein
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9lZ6a1rcusafx20MRAopjAJ9IuHZNPBXT6DMCbNSf2IPboPpruACfdj2g
RO2vXwlNeGbCQ6Y5xq7D07o=
=TRZu
-----END PGP SIGNATURE-----

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

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