-LRN: Don't free shutdown handle while it's in use
authorChristian Grothoff <christian@grothoff.org>
Sun, 24 Jun 2012 07:31:11 +0000 (07:31 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 24 Jun 2012 07:31:11 +0000 (07:31 +0000)
src/stream/stream_api.c

index 18435d0a760d2d4130630de30906aa696f2d72c1..df0710e80e434d8359af16064b78335b56e9b33d 100644 (file)
@@ -1741,8 +1741,6 @@ handle_generic_close_ack (struct GNUNET_STREAM_Socket *socket,
   if (NULL != shutdown_handle->completion_cb) /* Shutdown completion */
     shutdown_handle->completion_cb(shutdown_handle->completion_cls,
                                    operation);
-  GNUNET_free (shutdown_handle); /* Free shutdown handle */
-  socket->shutdown_handle = NULL;
   if (GNUNET_SCHEDULER_NO_TASK
       != shutdown_handle->close_msg_retransmission_task_id)
   {
@@ -1751,6 +1749,8 @@ handle_generic_close_ack (struct GNUNET_STREAM_Socket *socket,
     shutdown_handle->close_msg_retransmission_task_id =
       GNUNET_SCHEDULER_NO_TASK;
   }
+  GNUNET_free (shutdown_handle); /* Free shutdown handle */
+  socket->shutdown_handle = NULL;
   return GNUNET_OK;
 }