deckarep / gosx-notifier

gosx-notifier is a Go framework for sending desktop notifications to OSX 10.8 or higher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sample app: mem leak

syscrusher opened this issue · comments

There's a memory leak the sample app in the README.
In the pinger func, defer res.Body.Close() doesn't execute because the function doesn't return because of the loop. I would just close it before sleeping. Not pretty, but just a sample app.

Thanks for the package. Simple API, stable, and extremely useful.

Thanks mucho for pointing that out...excellent catch!

Also, thanks for the kind words...i'm glad you find it useful. =)

Sorry, I misled you slightly. We still have to call Close within the if that checks whether res is not nil. Otherwise we might try to close something that's not even open.