Message ID | 20190124141423.GA7822@delia |
---|---|
State | New |
Headers | show |
Series | [committed,nvptx,libgomp] Fix memleak in GOMP_OFFLOAD_fini_device | expand |
diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index ff90b67cb86..387e7cc6dd3 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -1936,6 +1936,12 @@ GOMP_OFFLOAD_fini_device (int n) instantiated_devices--; } + if (instantiated_devices == 0) + { + free (ptx_devices); + ptx_devices = NULL; + } + pthread_mutex_unlock (&ptx_dev_lock); return true; }