lukeredpath/libPusher — Issue #15: Static analyzer warning
Author: NightIsland
Created: 2011-12-09 10:18:55+00:00
State: open

I'm using XCode 4.2 and the LLVM 3.0 compiler, and when the static analyzer runs it complains about AsyncSocket.m line 935.

The line is this:

934: struct sockaddr_in6 *pSockAddr6 = (struct sockaddr_in6 *)[address6 bytes];
935: pSockAddr6->sin6_port = htons(chosenPort);

The warning is "Access to field 'sin6_port' results in a dereference of a null pointer".

The only way I could see to tell the silly analyzer this isn't the case is to add a test:

934: struct sockaddr_in6 *pSockAddr6 = (struct sockaddr_in6 *)[address6 bytes];
935: if (pSockAddr6)
936: pSockAddr6->sin6_port = htons(chosenPort);

I don't know how to use GitHub well enough to submit this code :-p sorry.