adobkin / libcapn

A simple C Library for interact with the Apple Push Notification Service (APNs)
MIT License
100 stars 37 forks source link

apn.c: 609: ioctlsocket ( cts->sock, ... ) #41

Open janknepper opened 7 years ago

janknepper commented 7 years ago

It seem the 'ctx->sock = sock' assignment on line 644 of apn.c should move up to line 607 (before #ifdef _WIN32). Right now fcntl/ioctlsocket is called on a -1. (condition of ctx->sock is checked earlier). Also, in case a connection is never established, ( ! connected ), the socket is never closed as the 'ctx -> sock = sock' assignment will not be performed until past the 'if'statement.