Skip to content

Commit b4ba694

Browse files
author
Ignacio Bonafonte
authored
Fix memory leak reserved in URLSession instrumentation (#327)
class_copyMethodList returns memory that should be freed
1 parent b7700ed commit b4ba694

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Sources/Instrumentation/URLSession/URLSessionInstrumentation.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public class URLSessionInstrumentation {
7373
var selectorFound = false
7474
var methodCount: UInt32 = 0
7575
guard let methodList = class_copyMethodList(theClass, &methodCount) else { return }
76+
defer { free(methodList) }
7677

7778
for j in 0..<selectorsCount {
7879
for i in 0..<Int(methodCount) {

0 commit comments

Comments
 (0)