DM:fix suspicious dereference of pointer in 'pci_emul_deinit()

suspicious dereference of pointer 'fi->fi_devi'
  by passing it to function 'pci_emul_free_bars()'
  before  NULL check.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Yonghua Huang 2018-05-22 19:38:48 +08:00 committed by lijinxia
parent 03ae242eb7
commit 4ed6d92226
1 changed files with 3 additions and 2 deletions

View File

@ -792,9 +792,10 @@ pci_emul_deinit(struct vmctx *ctx, struct pci_vdev_ops *ops, int bus, int slot,
if (fi->fi_param)
free(fi->fi_param);
pci_emul_free_bars(fi->fi_devi);
if (fi->fi_devi)
if (fi->fi_devi) {
pci_emul_free_bars(fi->fi_devi);
free(fi->fi_devi);
}
}
void