Skip to content

Commit

Permalink
Catch vol_list->contents == NULL
Browse files Browse the repository at this point in the history
vol_list->contents was not checked against NULL before so we had some
crashes caused by that.

We now check for NULL and do not crash anymore
  • Loading branch information
pstorz committed Oct 6, 2016
1 parent 2769580 commit 5e8e334
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/dird/storage.c
Expand Up @@ -543,14 +543,18 @@ static inline void free_vol_list(changer_vol_list_t *vol_list)
{
vol_list_t *vl;

foreach_dlist(vl, vol_list->contents) {
if (vl->VolName) {
free(vl->VolName);
if (vol_list->contents) {
foreach_dlist(vl, vol_list->contents) {
if (vl->VolName) {
free(vl->VolName);
}
}
vol_list->contents->destroy();
delete vol_list->contents;
vol_list->contents = NULL;
} else {
Dmsg0(100, "free_vol_list: vol_list->contents already empty\n");
}
vol_list->contents->destroy();
delete vol_list->contents;
vol_list->contents = NULL;
}

/*
Expand Down

0 comments on commit 5e8e334

Please sign in to comment.