sr_session_new(): Return SR_ERR_ARG upon invalid argument.
(instead of segfaulting)
This commit is contained in:
parent
4172352914
commit
41de54ffb1
|
@ -67,7 +67,7 @@ struct datafeed_callback {
|
|||
* is undefined and should not be used. Must not be NULL.
|
||||
*
|
||||
* @retval SR_OK Success.
|
||||
* @retval SR_ERR_BUG A session exists already.
|
||||
* @retval SR_ERR_ARG Invalid argument.
|
||||
*
|
||||
* @since 0.4.0
|
||||
*/
|
||||
|
@ -75,6 +75,9 @@ SR_API int sr_session_new(struct sr_session **new_session)
|
|||
{
|
||||
struct sr_session *session;
|
||||
|
||||
if (!new_session)
|
||||
return SR_ERR_ARG;
|
||||
|
||||
session = g_malloc0(sizeof(struct sr_session));
|
||||
|
||||
session->source_timeout = -1;
|
||||
|
|
Loading…
Reference in New Issue