gbm/dri: cleanup memory leak on teardown
authorEmil Velikov <emil.l.velikov@gmail.com>
Fri, 7 Nov 2014 03:45:07 +0000 (03:45 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 7 Nov 2014 18:32:07 +0000 (18:32 +0000)
During teardown we free the driver_configs list pointer, but we forget
to deallocate each config in that list.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
src/gbm/backends/dri/gbm_dri.c

index f637e323db9a386765c46d85536318828573d4b6..066426617bac561898eb35af47e37680b78a81c7 100644 (file)
@@ -914,8 +914,11 @@ static void
 dri_destroy(struct gbm_device *gbm)
 {
    struct gbm_dri_device *dri = gbm_dri_device(gbm);
+   unsigned i;
 
    dri->core->destroyScreen(dri->screen);
+   for (i = 0; dri->driver_configs[i]; i++)
+      free((__DRIconfig *) dri->driver_configs[i]);
    free(dri->driver_configs);
    dlclose(dri->driver);
    free(dri->base.driver_name);