drmPrime*: initialize output args to 0

Fix Valgrind errors because those memory was uninitialized.

https://bugs.freedesktop.org/show_bug.cgi?id=90194
Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>

v2: Explicitly zero the whole struct using memclear.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
main
Guillaume Desmottes 2015-04-29 10:16:22 +02:00 committed by Emil Velikov
parent 454b149494
commit 4bca42fc50
1 changed files with 3 additions and 1 deletions

View File

@ -2721,6 +2721,8 @@ int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd)
struct drm_prime_handle args;
int ret;
memclear(args);
args.fd = -1;
args.handle = handle;
args.flags = flags;
ret = drmIoctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args);
@ -2736,8 +2738,8 @@ int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle)
struct drm_prime_handle args;
int ret;
memclear(args);
args.fd = prime_fd;
args.flags = 0;
ret = drmIoctl(fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &args);
if (ret)
return ret;