OSDN Git Service

libdrm_radeon: Zero-initialize structures to silence valgrind warnings
authorNicolai Hähnle <nhaehnle@gmail.com>
Sat, 3 Oct 2009 11:43:42 +0000 (13:43 +0200)
committerNicolai Hähnle <nhaehnle@gmail.com>
Sat, 3 Oct 2009 11:46:10 +0000 (13:46 +0200)
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
libdrm/radeon/radeon_bo_gem.c

index 76d80e7..d34f24c 100644 (file)
@@ -137,6 +137,9 @@ static struct radeon_bo *bo_unref(struct radeon_bo *bo)
         munmap(bo_gem->priv_ptr, bo->size);
     }
 
+    /* Zero out args to make valgrind happy */
+    memset(&args, 0, sizeof(args));
+
     /* close object */
     args.handle = bo->handle;
     ioctl(bo->bom->fd, DRM_IOCTL_GEM_CLOSE, &args);
@@ -160,6 +163,9 @@ static int bo_map(struct radeon_bo *bo, int write)
     }
 
     bo->ptr = NULL;
+
+    /* Zero out args to make valgrind happy */
+    memset(&args, 0, sizeof(args));
     args.handle = bo->handle;
     args.offset = 0;
     args.size = (uint64_t)bo->size;
@@ -201,6 +207,8 @@ static int bo_wait(struct radeon_bo *bo)
     struct drm_radeon_gem_wait_idle args;
     int ret;
 
+    /* Zero out args to make valgrind happy */
+    memset(&args, 0, sizeof(args));
     args.handle = bo->handle;
     do {
         ret = drmCommandWriteRead(bo->bom->fd, DRM_RADEON_GEM_WAIT_IDLE,