TT#14400 Do not NULL-dereference pointer

When debugging mode is enabled, and the socket variable is NULL, we will
try to dereference it to print the debug message. Split the checks to
avoid that.

Change-Id: I0e0643900d3d8463937b7fd47b21cd91cf49b73c
changes/62/12662/1
Guillem Jover 8 years ago
parent bd833c2586
commit 0b1bdbb339

@ -633,7 +633,11 @@ int connect_socket_nb(socket_t *r, int type, const endpoint_t *ep) {
}
int close_socket(socket_t *r) {
if (!r || r->fd == -1) {
if (!r) {
__C_DBG("close() syscall not called, no socket");
return -1;
}
if (r->fd == -1) {
__C_DBG("close() syscall not called, fd=%d", r->fd);
return -1;
}

Loading…
Cancel
Save