uri: Prevent memory leak when opening compressed files
diff --git a/common/lib/uri.c b/common/lib/uri.c
index 979595c3..80b24bf6 100644
--- a/common/lib/uri.c
+++ b/common/lib/uri.c
@@ -282,8 +282,9 @@ struct file_handle *uri_open(char *uri) {
compressed_fd->path = ext_mem_alloc(ret->path_len);
memcpy(compressed_fd->path, ret->path, ret->path_len);
compressed_fd->path_len = ret->path_len;
- fclose(ret);
compressed_fd->is_memfile = true;
+ fclose(ret);
+ pmm_free(src, ret->size);
ret = compressed_fd;
}
