diff --git a/libretro-common/file/nbio/nbio_stdio.c b/libretro-common/file/nbio/nbio_stdio.c index f783f0bd9f..28348c9e4a 100644 --- a/libretro-common/file/nbio/nbio_stdio.c +++ b/libretro-common/file/nbio/nbio_stdio.c @@ -60,7 +60,12 @@ struct nbio_t* nbio_open(const char * filename, unsigned mode) error: if (handle) + { + if (handle->data) + free(handle->data); + handle->data = NULL; free(handle); + } handle = NULL; fclose(f); return NULL;