strings: Allow calling strings__delete with a NULL pointer

Just like free, and as this is the common exit path of the tools, we
better do that not to segfault when not asking for something. ;-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-03-20 10:35:57 -03:00
parent 57127d45fc
commit 659c1eae69
1 changed files with 2 additions and 0 deletions

View File

@ -37,6 +37,8 @@ static void do_nothing(void *ptr __unused)
void strings__delete(struct strings *self)
{
if (self == NULL)
return;
tdestroy(self->tree, do_nothing);
__gobuffer__delete(&self->gb);
free(self);