DM: fix memory leak

1. free memory allocated by strdup in blockif_open
2. free msix.table when its pci device deinit

Tracked-On: #2704
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
Minggui Cao
2019-03-13 10:23:38 +08:00
committed by Eddie Dong
parent 436c30e4c5
commit 5397200118
2 changed files with 22 additions and 0 deletions

View File

@@ -759,8 +759,18 @@ blockif_open(const char *optstr, const char *ident)
pthread_setname_np(bc->btid[i], tname);
}
/* free strdup memory */
if (nopt) {
free(nopt);
nopt = NULL;
}
return bc;
err:
/* handle failure case: free strdup memory*/
if (nopt)
free(nopt);
if (fd >= 0)
close(fd);
return NULL;