mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Fix small leak
This commit is contained in:
@@ -158,6 +158,9 @@ public final class WriteBuffer: MemoryBuffer {
|
||||
if self.offset + length > self.capacity {
|
||||
self.capacity = self.offset + length + 256
|
||||
if self.length == 0 {
|
||||
if self.freeWhenDone {
|
||||
free(self.memory)
|
||||
}
|
||||
self.memory = malloc(self.capacity)!
|
||||
} else {
|
||||
self.memory = realloc(self.memory, self.capacity)
|
||||
@@ -173,6 +176,9 @@ public final class WriteBuffer: MemoryBuffer {
|
||||
if self.offset + length > self.capacity {
|
||||
self.capacity = self.offset + length + 256
|
||||
if self.length == 0 {
|
||||
if self.freeWhenDone {
|
||||
free(self.memory)
|
||||
}
|
||||
self.memory = malloc(self.capacity)!
|
||||
} else {
|
||||
self.memory = realloc(self.memory, self.capacity)
|
||||
|
||||
Reference in New Issue
Block a user