Skip to content

Commit

Permalink
Fix bogus jump to "error" label.
Browse files Browse the repository at this point in the history
if unhash_fd_map() is not done, do not try to do fix_fd_array() .

(cherry picked from commit 9c066e6)
  • Loading branch information
bogdan-iancu committed May 11, 2015
1 parent c358997 commit 885097d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions io_wait.h
Expand Up @@ -591,7 +591,7 @@ inline static int io_watch_del(io_wait_h* h, int fd, int idx,

if ((fd<0) || (fd>=h->max_fd_no)){
LM_CRIT("[%s] invalid fd %d, not in [0, %d)\n", h->name, fd, h->fd_no);
goto error;
goto error0;
}
LM_DBG("[%s] io_watch_del op on index %d %d (%p, %d, %d, 0x%x,0x%x) "
"fd_no=%d called\n", h->name,idx,fd, h, fd, idx, flags,
Expand All @@ -602,19 +602,19 @@ inline static int io_watch_del(io_wait_h* h, int fd, int idx,
/* more sanity checks */
if (e==0){
LM_CRIT("[%s] no corresponding hash entry for %d\n",h->name, fd);
goto error;
goto error0;
}
if (e->type==0 /*F_NONE*/){
LM_ERR("[%s] trying to delete already erased"
" entry %d in the hash(%d, %d, %p) )\n",
h->name,fd, e->fd, e->type, e->data);
goto error;
goto error0;
}

if ((e->flags & sock_flags) == 0) {
LM_ERR("BUG - [%s] trying to del fd %d with flags %d %d\n",
h->name, fd, e->flags,sock_flags);
goto error;
goto error0;
}

unhash_fd_map(e,flags,sock_flags,erase);
Expand Down Expand Up @@ -735,6 +735,7 @@ inline static int io_watch_del(io_wait_h* h, int fd, int idx,
* "fd_hash" and "fd_array" must remain consistent
*/
fix_fd_array;
error0:
return -1;
#undef fix_fd_array
}
Expand Down

0 comments on commit 885097d

Please sign in to comment.