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:
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.