mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-07 18:12:55 +03:00
async.c: added missing check for NULL in coap_free_async()
Coverity scan has detected a possible NULL pointer being dereferenced before it is checked, see CID 1458391.
This commit is contained in:
1 parent
1f51ba7636
commit
6fb2e671d1
1 file changed
+9
-5
+9
-5
@@ -98,11 +98,15 @@ coap_remove_async(coap_context_t *context, coap_session_t *session,
|
||||
|
||||
void
|
||||
coap_free_async(coap_async_state_t *s) {
|
||||
if ( s->session )
|
||||
coap_session_release( s->session );
|
||||
if (s && (s->flags & COAP_ASYNC_RELEASE_DATA) != 0)
|
||||
coap_free(s->appdata);
|
||||
coap_free(s);
|
||||
if (s) {
|
||||
if (s->session) {
|
||||
coap_session_release(s->session);
|
||||
}
|
||||
if ((s->flags & COAP_ASYNC_RELEASE_DATA) != 0) {
|
||||
coap_free(s->appdata);
|
||||
}
|
||||
coap_free(s);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Reference in new issue
Block a user