songvec: avoid free(NULL)

Potentially broken free() implementations don't like it
This commit is contained in:
Eric Wong 2008-09-23 22:38:43 +02:00 committed by Max Kellermann
parent 74b34f7b61
commit ef35926083
1 changed files with 4 additions and 2 deletions

View File

@ -60,7 +60,9 @@ void songvec_add(struct songvec *sv, Song *add)
void songvec_free(struct songvec *sv)
{
free(sv->base);
sv->base = NULL;
if (sv->base) {
free(sv->base);
sv->base = NULL;
}
sv->nr = 0;
}