Wrong configuration segmentionfault #1065

Merged
merged 3 commits into from Jan 2, 2014

Conversation

Projects
None yet
2 participants
@skinkie
Member

skinkie commented Jan 2, 2014

In issue #356 I have described a way to alter the configuration file which caused a segmentation fault in the webserver. This segmentation fault origins from the fact that if a configuration phase is broken off, the properties of the handler will be freed. If the properties are on the other hand never initialised this will case badness in some (very) minor locations.

My solution vector is to first initialise the base class, so everything is set up to be "potentially" freed, just in case. Then the configuration phase hits in.

Specially review the handler_proxy.c code where I move the initialisation of the proxy hosts, to a different location, and I wonder if that is a good idea ...or not.

(I notice some commits are unrelated here)

skinkie added some commits Jan 2, 2014

Initialise the base class in the configuration phase, before parsing …
…the configuration.

This scheme prevents that a _free on the final class, results in chaos
because the base is not initialised yet, while an attempt is made to
free it.
Free the virtual server if the configuration fails
In an extremely unlikely case that a configuration of a virtual server
fails we must free what we have just allocated.

The virtual server cannot be freed prior to a succesfull _new,
we may leak memory there, but in that situation we already exit the
server (too).
@kinnison

This comment has been minimized.

Show comment
Hide comment
@kinnison

kinnison Jan 2, 2014

Contributor

I've looked as requested, but cannot see anything bad per-se. I'm not terribly pleased with unrelated commits in the same pull request but I understand how it goes :-)

This is not somewhere in the codebase I'm yet familiar though, so there may yet be issues I simply cannot predict.

Contributor

kinnison commented Jan 2, 2014

I've looked as requested, but cannot see anything bad per-se. I'm not terribly pleased with unrelated commits in the same pull request but I understand how it goes :-)

This is not somewhere in the codebase I'm yet familiar though, so there may yet be issues I simply cannot predict.

@skinkie

This comment has been minimized.

Show comment
Hide comment
@skinkie

skinkie Jan 2, 2014

Member

In a shower moment I realised that there might be another solution for the base class initialisation that works out better.

Member

skinkie commented Jan 2, 2014

In a shower moment I realised that there might be another solution for the base class initialisation that works out better.

skinkie added a commit that referenced this pull request Jan 2, 2014

Merge pull request #1065 from cherokee/wrong_configuration_segv_356
I'm going for this solution, if anyone has a better solution, do propose it.

@skinkie skinkie merged commit dc123e2 into master Jan 2, 2014

@skinkie skinkie deleted the wrong_configuration_segv_356 branch Jan 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment