diff --git a/lib/service.c b/lib/service.c
index 057b56926b68a502300bbb8861736fb4eeaf9013..a17496e71f4c3ad62f8d783da391f72477598e7f 100644
--- a/lib/service.c
+++ b/lib/service.c
@@ -400,9 +400,7 @@ libwebsocket_service_fd(struct libwebsocket_context *context,
 				if (m == our_fd) {
 					/* it was the guy we came to service! */
 					timed_out = 1;
-					/* mark as handled */
-					if (pollfd)
-						pollfd->revents = 0;
+					/* he's gone, no need to mark as handled */
 				}
 		}
 	}
@@ -619,7 +617,8 @@ close_and_handled:
 	lwsl_debug("Close and handled\n");
 	libwebsocket_close_and_free_session(context, wsi,
 						LWS_CLOSE_STATUS_NOSTATUS);
-	n = 1;
+	// pollfd points to something else after the close
+	return 1;
 
 handled:
 	pollfd->revents = 0;