Commit fbc81e88 authored by smorlat's avatar smorlat
Browse files

fix unchecked memory allocation.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@719 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent ac42c950
No related merge requests found
Showing with 22 additions and 1 deletion
......@@ -75,8 +75,18 @@ typedef pthread_cond_t ortp_cond_t;
#pragma warning(disable : 1469) // "cc" clobber ignored
#endif
#ifdef __cplusplus
extern "C"
{
#endif
int __ortp_thread_join(ortp_thread_t thread, void **ptr);
int __ortp_thread_create(pthread_t *thread, pthread_attr_t *attr, void * (*routine)(void*), void *arg);
#ifdef __cplusplus
}
#endif
#define ortp_thread_create __ortp_thread_create
#define ortp_thread_join __ortp_thread_join
#define ortp_thread_exit pthread_exit
......
......@@ -213,6 +213,12 @@ mblk_t *rtp_getq_permissive(queue_t *q,uint32_t timestamp, int *rejected)
void
rtp_session_init (RtpSession * session, int mode)
{
if (session == NULL)
{
ortp_debug("rtp_session_init: Invalid paramter (session=NULL)");
return;
}
JBParameters jbp;
memset (session, 0, sizeof (RtpSession));
session->mode = (RtpSessionMode) mode;
......@@ -293,7 +299,12 @@ rtp_session_new (int mode)
{
RtpSession *session;
session = (RtpSession *) ortp_malloc (sizeof (RtpSession));
rtp_session_init (session, mode);
if (session == NULL)
{
ortp_error("rtp_session_new: Memory allocation failed");
return NULL;
}
rtp_session_init (session, mode);
return session;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment