about summary refs log tree commit diff stats
path: root/src/types/blob.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/types/blob.nim')
-rw-r--r--src/types/blob.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/types/blob.nim b/src/types/blob.nim
index 505e4f7c..3af362d4 100644
--- a/src/types/blob.nim
+++ b/src/types/blob.nim
@@ -34,6 +34,12 @@ proc newBlob*(buffer: pointer, size: int, ctype: string,
 proc finalize(blob: Blob) {.jsfin.} =
   if blob.deallocFun != nil and blob.buffer != nil:
     blob.deallocFun(blob.buffer)
+    blob.buffer = nil
+
+proc finalize(file: WebFile) {.jsfin.} =
+  if file.deallocFun != nil and file.buffer != nil:
+    file.deallocFun(file.buffer)
+    file.buffer = nil
 
 proc newWebFile*(path: string, webkitRelativePath = ""): WebFile =
   var file: File