deckarep / gosx-notifier

gosx-notifier is a Go framework for sending desktop notifications to OSX 10.8 or higher
MIT License
588 stars 51 forks source link

sample app: mem leak #7

Closed syscrusher closed 10 years ago

syscrusher commented 10 years ago

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.

deckarep commented 10 years ago

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

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

syscrusher commented 10 years ago

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.