summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2009-01-22 21:47:38 +1000
committerDave Airlie <[email protected]>2009-01-22 21:47:38 +1000
commit860d0cc656ee0eb724b2d82596c09a9eee9a8d19 (patch)
tree70b0b20d608d2f391a3b5c600c0dadaa170c19c1 /src/mesa/drivers
parent02952a41eb0e47ab77a984922c1c3202aeb45b50 (diff)
radeon: free all relocs in array
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_cs_legacy.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
index b9751248280..1f07c1c6c4f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
@@ -135,7 +135,7 @@ static int cs_write_reloc(struct radeon_cs *cs,
relocs[i].base.read_domain |= read_domain;
relocs[i].base.write_domain |= write_domain;
/* save indice */
- relocs[i].cindices += 1;
+ relocs[i].cindices++;
indices = (uint32_t*)realloc(relocs[i].indices,
relocs[i].cindices * 4);
if (indices == NULL) {
@@ -335,16 +335,21 @@ static int cs_emit(struct radeon_cs *cs)
return 0;
}
-static void inline cs_free_reloc(void *relocs_p)
+static void inline cs_free_reloc(void *relocs_p, int crelocs)
{
struct cs_reloc_legacy *relocs = relocs_p;
- if (relocs)
- free(relocs->indices);
+ int i;
+
+ for (i = 0; i < crelocs; i++) {
+ struct cs_reloc_legacy *ptr = relocs[i];
+ if (ptr)
+ free(ptr->indices);
+ }
}
static int cs_destroy(struct radeon_cs *cs)
{
- cs_free_reloc(cs->relocs);
+ cs_free_reloc(cs->relocs, cs->crelocs);
free(cs->relocs);
free(cs->packets);
free(cs);
@@ -353,7 +358,7 @@ static int cs_destroy(struct radeon_cs *cs)
static int cs_erase(struct radeon_cs *cs)
{
- cs_free_reloc(cs->relocs);
+ cs_free_reloc(cs->relocs, cs->crelocs);
free(cs->relocs);
cs->relocs_total_size = 0;
cs->relocs = NULL;