summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-07-12 13:09:33 +1000
committerDave Airlie <airlied@redhat.com>2010-07-12 13:09:33 +1000
commite5159771bd0a013201dcef760e9320071c6df59e (patch)
tree5b0f4c1d397da47f3c15da438d831986e39fede3
parent3f59728ddc6f7d2cb17d434e81ac76c9288d0aef (diff)
downloadlibpciaccess-e5159771bd0a013201dcef760e9320071c6df59e.tar.gz
libpciaccess-e5159771bd0a013201dcef760e9320071c6df59e.tar.bz2
libpciaccess-e5159771bd0a013201dcef760e9320071c6df59e.zip
pciaccess: fix use after free.
Using the pointer passed to realloc earlier isn't a recipe for success. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/common_interface.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common_interface.c b/src/common_interface.c
index d46feab..4af772a 100644
--- a/src/common_interface.c
+++ b/src/common_interface.c
@@ -317,8 +317,8 @@ pci_device_map_range(struct pci_device *dev, pciaddr_t base,
*addr = mappings[devp->num_mappings].memory;
devp->num_mappings++;
} else {
- mappings = realloc(devp->mappings,
- (sizeof(devp->mappings[0]) * devp->num_mappings));
+ mappings = realloc(mappings,
+ (sizeof(mappings[0]) * devp->num_mappings));
}
devp->mappings = mappings;