:: commit ccb0d0f738b8b18c2807b9d1961016a689ab131b

mintsuki <mintsuki@protonmail.com> — 2023-02-15 20:09

parents: d22b97cf66

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;
     }
 
tab: 248 wrap: offon