Logo Search packages:      
Sourcecode: srtp version File versions  Download package

err_status_t srtp_dealloc ( srtp_t  s  ) 

srtp_dealloc() deallocates storage for an SRTP session context.

The function call srtp_dealloc(s) deallocates storage for the SRTP session context s. This function should be called no more than one time for each of the contexts allocated by the function srtp_create().

Parameters:
s is the srtp_t for the session to be deallocated.
Returns:
  • err_status_ok if there no problems.
  • err_status_dealloc_fail a memory deallocation failure occured.

Definition at line 1137 of file srtp.c.

References err_status_ok.

Referenced by srtp_create().

                             {
  srtp_stream_ctx_t *stream;
  err_status_t status;

  /*
   * we take a conservative deallocation strategy - if we encounter an
   * error deallocating a stream, then we stop trying to deallocate
   * memory and just return an error
   */

  /* walk list of streams, deallocating as we go */
  stream = session->stream_list;
  while (stream != NULL) {
    srtp_stream_t next = stream->next;
    status = srtp_stream_dealloc(session, stream);
    if (status)
      return status;
    stream = next;
  }
  
  /* deallocate stream template, if there is one */
  if (session->stream_template != NULL) {
    status = auth_dealloc(session->stream_template->rtcp_auth); 
    if (status) 
      return status; 
    status = cipher_dealloc(session->stream_template->rtcp_cipher); 
    if (status) 
      return status; 
    crypto_free(session->stream_template->limit);
    status = cipher_dealloc(session->stream_template->rtp_cipher); 
    if (status) 
      return status; 
    status = auth_dealloc(session->stream_template->rtp_auth);
    if (status)
      return status;
    crypto_free(session->stream_template);
  }

  /* deallocate session context */
  crypto_free(session);

  return err_status_ok;
}


Generated by  Doxygen 1.6.0   Back to index