Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nil pointer dereference #21

Open
mannaz opened this issue Feb 16, 2017 · 2 comments
Open

Nil pointer dereference #21

mannaz opened this issue Feb 16, 2017 · 2 comments

Comments

@mannaz
Copy link

mannaz commented Feb 16, 2017

In case of unreachable graylog server GraylogHook.gelfLogger is silently initialized to nil: graylog_hook.go#L46 -> graylog_hook.go#L60
Then program crashes with nil pointer dereference on sending entry: graylog_hook.go#L146 -> graylog_hook.go#L208

I believe NewGraylogHook should return error and/or nil *GraylogHook or as a backward-compatible solution *GraylogHook should provide method to get initialization error.

@gravis
Copy link
Member

gravis commented Feb 19, 2017

Good catch!
I have turned this in my head several times: I don't think workaround solutions are better than returning the error in the initializer. As this is a breaking API change, we'll use gopkg.in to bump to 3.0 (that doesn't really make sense, but unless we have a real package manager in go, that's the way to go).

Thanks, I'll publish the new version in a few minutes.

@gravis gravis closed this as completed in 3854c2f Feb 19, 2017
@gravis
Copy link
Member

gravis commented Feb 19, 2017

1st step, fixing this for 2.x branch, so current user won't be affected.
Next step, 3.x branch with different api.

@gravis gravis reopened this Feb 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants