From 576dbe12e64697f10aaa15f6ef23e0a3d5eea5b5 Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Tue, 25 Jul 2017 14:25:36 +0300 Subject: [PATCH] Fixed memory release --- src/network.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network.c b/src/network.c index 0a49bf1f..79940e65 100644 --- a/src/network.c +++ b/src/network.c @@ -595,11 +595,14 @@ void free_network(network net) free_layer(net.layers[i]); } free(net.layers); - free(net.workspace); #ifdef GPU + if (gpu_index >= 0) cuda_free(net.workspace); + else free(net.workspace); if (*net.input_gpu) cuda_free(*net.input_gpu); if (*net.truth_gpu) cuda_free(*net.truth_gpu); if (net.input_gpu) free(net.input_gpu); if (net.truth_gpu) free(net.truth_gpu); +#else + free(net.workspace); #endif }