Only free members of connection_t that have been allocated.

This commit is contained in:
Guus Sliepen 2007-03-12 17:55:43 +00:00
parent 39f6d59b4b
commit 3730156165

View file

@ -79,15 +79,25 @@ void free_connection(connection_t *c)
{
cp();
if(c) {
free(c->hostname);
free(c->inkey);
free(c->outkey);
free(c->mychallenge);
free(c->hischallenge);
event_del(&c->ev);
}
if(!c)
return;
if(c->hostname)
free(c->hostname);
if(c->inkey)
free(c->inkey);
if(c->outkey)
free(c->outkey);
if(c->mychallenge)
free(c->mychallenge);
if(c->hischallenge)
free(c->hischallenge);
event_del(&c->ev);
free(c);
}