File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,11 @@ public class ColorSetStream: NSObject
242242 {
243243 let nb = UnsafeMutableBufferPointer< UInt64 > . allocate( capacity: 1 )
244244
245+ defer
246+ {
247+ nb. deallocate ( )
248+ }
249+
245250 if self . read ( size: 8 , in: nb )
246251 {
247252 guard let n = nb. first? . littleEndian
@@ -290,6 +295,14 @@ public class ColorSetStream: NSObject
290295 let bb = UnsafeMutableBufferPointer< Double > . allocate( capacity: 1 )
291296 let ab = UnsafeMutableBufferPointer< Double > . allocate( capacity: 1 )
292297
298+ defer
299+ {
300+ rb. deallocate ( )
301+ gb. deallocate ( )
302+ bb. deallocate ( )
303+ ab. deallocate ( )
304+ }
305+
293306 if self . read ( size: 8 , in: rb ) ,
294307 self . read ( size: 8 , in: gb ) ,
295308 self . read ( size: 8 , in: bb ) ,
@@ -325,6 +338,11 @@ public class ColorSetStream: NSObject
325338 {
326339 let buffer = UnsafeMutableBufferPointer< UInt8 > . allocate( capacity: Int ( length ) )
327340
341+ defer
342+ {
343+ buffer. deallocate ( )
344+ }
345+
328346 if self . read ( size: length, in: buffer )
329347 {
330348 return Data ( buffer: buffer )
You can’t perform that action at this time.
0 commit comments