summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-05-03 01:57:05 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-05-03 01:57:05 +0200
commit4753ea5cded2ed3fdd68d8e5b656566f6b9771ab (patch)
tree27b34837dfb13c39a81cc9260bceb251f6bafd4d
parent38c014cf6724aa84cb59da1da749a88090bae377 (diff)
downloadpcitool-4753ea5cded2ed3fdd68d8e5b656566f6b9771ab.tar.gz
pcitool-4753ea5cded2ed3fdd68d8e5b656566f6b9771ab.tar.bz2
pcitool-4753ea5cded2ed3fdd68d8e5b656566f6b9771ab.tar.xz
pcitool-4753ea5cded2ed3fdd68d8e5b656566f6b9771ab.zip
Prevent double-free of pcilib context when open fails
-rw-r--r--pcilib/pci.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/pcilib/pci.c b/pcilib/pci.c
index 3769fd4..62b3c64 100644
--- a/pcilib/pci.c
+++ b/pcilib/pci.c
@@ -118,7 +118,6 @@ pcilib_t *pcilib_open(const char *device, const char *model) {
if ((!ctx->registers)||(!ctx->register_ctx)) {
pcilib_error("Error allocating memory for register model");
pcilib_close(ctx);
- free(ctx);
return NULL;
}
@@ -141,7 +140,6 @@ pcilib_t *pcilib_open(const char *device, const char *model) {
else
pcilib_error("Error (%i) configuring model %s", err, (model?model:""));
pcilib_close(ctx);
- free(ctx);
return NULL;
}
@@ -158,7 +156,6 @@ pcilib_t *pcilib_open(const char *device, const char *model) {
if (err) {
pcilib_error("Error (%i) initializing regiser banks\n", err);
pcilib_close(ctx);
- free(ctx);
return NULL;
}
@@ -166,7 +163,6 @@ pcilib_t *pcilib_open(const char *device, const char *model) {
if (err) {
pcilib_error("Error (%i) initializing event engine\n", err);
pcilib_close(ctx);
- free(ctx);
return NULL;
}
}