False positive: RESOURCE_LEAK at SimplePing.m (Apple's sample)
- Langage dominant
- OCaml
- Étoiles
- 15.7k
- Forks
- 2.1k
- Merge moyen
- 19 h 36 min
- PR mergées (30 j)
- 13
Description
Language: Objective-C
Source: SimplePing.m from https://developer.apple.com/library/content/samplecode/SimplePing/Introduction/Intro.html
infer: v0.12.1
Error report:
SimplePing/Common/SimplePing.m:604: error: RESOURCE_LEAK
resource acquired by call to `socket()` at line 603, column 18 is not released after line 604, column 17
602. case AF_INET6: {
603. fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6);
604. > if (fd < 0) {
605. err = errno;
606. }
SimplePing/Common/SimplePing.m:598: error: RESOURCE_LEAK
resource acquired by call to `socket()` at line 597, column 18 is not released after line 598, column 17
596. case AF_INET: {
597. fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
598. > if (fd < 0) {
599. err = errno;
600. }
But few lines below in code we can find this line:
`self.socket = (CFSocketRef) CFAutorelease( CFSocketCreateWithNative(NULL, fd, kCFSocketReadCallBack, SocketReadCallback, &context) );`. Therefore socket was managed correctly.
How i can suppress this kind of warnings?
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.