Skip to content

Commit

Permalink
ares_destroy.c: fix segfault in ares_destroy_options()
Browse files Browse the repository at this point in the history
  • Loading branch information
yangtse committed Aug 21, 2011
1 parent d0c3cb6 commit b816675
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ares_destroy.c
@@ -1,6 +1,6 @@

/* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright (C) 2004-2010 by Daniel Stenberg
* Copyright (C) 2004-2011 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
Expand Down Expand Up @@ -29,10 +29,12 @@ void ares_destroy_options(struct ares_options *options)
free(options->servers);
for (i = 0; i < options->ndomains; i++)
free(options->domains[i]);
free(options->domains);
if(options->domains)
free(options->domains);
if(options->sortlist)
free(options->sortlist);
free(options->lookups);
if(options->lookups)
free(options->lookups);
}

void ares_destroy(ares_channel channel)
Expand Down

0 comments on commit b816675

Please sign in to comment.