-avoid use after free
[oweals/gnunet.git] / src / conversation / conversation_api_call.c
index efd6a60de3c748679b5028807c254088a71abf03..4a671cbda714786c65518d19926eb47921c6e68f 100644 (file)
@@ -537,10 +537,10 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call)
  * @param caller_id identity of the caller
  * @param callee GNS name of the callee (used to locate the callee's record)
  * @param speaker speaker to use (will be used automatically immediately once the
- *        #GNUNET_CONVERSATION_EC_READY event is generated); we will NOT generate
+ *        #GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated); we will NOT generate
  *        a ring tone on the speaker
  * @param mic microphone to use (will be used automatically immediately once the
- *        #GNUNET_CONVERSATION_EC_READY event is generated)
+ *        #GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated)
  * @param event_handler how to notify the owner of the phone about events
  * @param event_handler_cls closure for @a event_handler
  */
@@ -595,8 +595,6 @@ finish_stop (void *cls)
  * Terminate a call.  The call may be ringing or ready at this time.
  *
  * @param call call to terminate
- * @param reason if the call was active (ringing or ready) this will be the
- *        reason given to the other user for why we hung up
  */
 void
 GNUNET_CONVERSATION_call_stop (struct GNUNET_CONVERSATION_Call *call)
@@ -612,10 +610,10 @@ GNUNET_CONVERSATION_call_stop (struct GNUNET_CONVERSATION_Call *call)
     call->mic->disable_microphone (call->mic->cls);
   if (CS_SHUTDOWN != call->state)
   {
+    call->state = CS_SHUTDOWN;
     e = GNUNET_MQ_msg (hang, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP);
     GNUNET_MQ_notify_sent (e, &finish_stop, call);
     GNUNET_MQ_send (call->mq, e);
-    call->state = CS_SHUTDOWN;
     return;
   }
   if (NULL != call->mq)
@@ -674,14 +672,12 @@ GNUNET_CONVERSATION_call_suspend (struct GNUNET_CONVERSATION_Call *call)
 
 
 /**
- * Resumes a call after #GNUNET_CONVERSATION_call_pause.
+ * Resumes a call after #GNUNET_CONVERSATION_call_suspend.
  *
  * @param call call to resume
- * @param speaker speaker to use (will be used automatically immediately once the
- *        #GNUNET_CONVERSATION_EC_READY event is generated); we will NOT generate
+ * @param speaker speaker to use
  *        a ring tone on the speaker
- * @param mic microphone to use (will be used automatically immediately once the
- *        #GNUNET_CONVERSATION_EC_READY event is generated)
+ * @param mic microphone to use
  */
 void
 GNUNET_CONVERSATION_call_resume (struct GNUNET_CONVERSATION_Call *call,