Only free members of connection_t that have been allocated.
This commit is contained in:
parent
39f6d59b4b
commit
3730156165
1 changed files with 18 additions and 8 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue