diff --git a/nbio/nbio_stdio.c b/nbio/nbio_stdio.c index 989dea766b..c3e8bbd2f2 100644 --- a/nbio/nbio_stdio.c +++ b/nbio/nbio_stdio.c @@ -45,7 +45,7 @@ struct nbio_t* nbio_open(const char * filename, enum nbio_mode_t mode) handle->data = malloc(handle->len); - if (!handle->data) + if (handle->len && !handle->data) { free(handle); fclose(f);