swrap: Fix use-after-free
authorAnoop C S <anoopcs@redhat.com>
Tue, 25 Oct 2016 17:03:10 +0000 (22:33 +0530)
committerMichael Adam <obnox@samba.org>
Tue, 25 Oct 2016 21:20:51 +0000 (23:20 +0200)
This was introduced by commit 9ce583b6cd6f55d473e5b54794fb06450997ebc8

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
src/socket_wrapper.c

index d40f8b611e94385ca18a2b49675221c9b3a4fb93..ece5a101fe4e0bc4022f3298a70cf79dc71d31fb 100644 (file)
@@ -1733,7 +1733,7 @@ static void swrap_remove_stale(int fd)
        SWRAP_DLIST_REMOVE(socket_fds, fi);
        free(fi);
 
-       si = &sockets[fi->si_index];
+       si = &sockets[si_index];
        si->refcount--;
 
        if (si->refcount > 0) {