You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a memory leak in Markdown.swift at line 47:
var dest = [UnsafeMutablePointer<Int8>?](repeating: UnsafeMutablePointer<Int8>.allocate(capacity: 1), count: 1)
This line is allocating space for a pointer to be returned, but in doing so is also allocating an actual pointer to one byte of memory. When fun is called to process data and return a result, the allocated pointer is overwritten and the one-byte allocation (16 actual bytes) is lost.
Since all you need is space for a pointer here, and since the array is an array-of-optionals, you can just replace that line with this:
var dest: [UnsafeMutablePointer<Int8>?] = [nil]
No allocation, so no leak.
The text was updated successfully, but these errors were encountered:
There's a memory leak in
Markdown.swift
at line 47:This line is allocating space for a pointer to be returned, but in doing so is also allocating an actual pointer to one byte of memory. When
fun
is called to process data and return a result, the allocated pointer is overwritten and the one-byte allocation (16 actual bytes) is lost.Since all you need is space for a pointer here, and since the array is an array-of-optionals, you can just replace that line with this:
No allocation, so no leak.
The text was updated successfully, but these errors were encountered: