uri: Fix minor use-after-free bug
diff --git a/common/lib/uri.c b/common/lib/uri.c
index 80b24bf6..4d2cb63f 100644
--- a/common/lib/uri.c
+++ b/common/lib/uri.c
@@ -283,8 +283,9 @@ struct file_handle *uri_open(char *uri) {
memcpy(compressed_fd->path, ret->path, ret->path_len);
compressed_fd->path_len = ret->path_len;
compressed_fd->is_memfile = true;
+ uint64_t src_size = ret->size;
fclose(ret);
- pmm_free(src, ret->size);
+ pmm_free(src, src_size);
ret = compressed_fd;
}
