GEM: Allocate the right number of relocs, avoiding heap smashing.
authorEric Anholt <eric@anholt.net>
Mon, 5 May 2008 22:45:15 +0000 (15:45 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 5 May 2008 22:45:15 +0000 (15:45 -0700)
src/mesa/drivers/dri/intel/intel_bufmgr_gem.c

index 6f0ecfbdb8647d2a7c995f10a7908a99bc5be29a..e4e8481b962b3661374d389b52fc5b4abfcd620d 100644 (file)
@@ -247,7 +247,7 @@ intel_setup_reloc_list(dri_bo *bo)
 
     bo_gem->relocs = calloc(bufmgr_gem->max_relocs,
                            sizeof(struct drm_i915_gem_relocation_entry));
-    bo_gem->reloc_target_bo = calloc(1, sizeof(dri_bo *));
+    bo_gem->reloc_target_bo = calloc(bufmgr_gem->max_relocs, sizeof(dri_bo *));
 
     return 0;
 }