[sofia-sip] scan-build: Access to field 'c_nettype' results in a dereference of a null pointer (loaded from variable 'a')

This commit is contained in:
Dragos Oancea 2020-02-12 01:21:30 +00:00
parent 1b66e76548
commit 602eaeb169
1 changed files with 2 additions and 0 deletions

View File

@ -1244,6 +1244,8 @@ int sdp_connection_cmp(sdp_connection_t const *a, sdp_connection_t const *b)
if ((a != NULL) != (b != NULL)) if ((a != NULL) != (b != NULL))
return (a != NULL) < (b != NULL) ? -1 : 1; return (a != NULL) < (b != NULL) ? -1 : 1;
if (!a || !b)
return -1;
if (a->c_nettype != b->c_nettype) if (a->c_nettype != b->c_nettype)
return a->c_nettype < b->c_nettype ? -1 : 1; return a->c_nettype < b->c_nettype ? -1 : 1;
if (a->c_addrtype != b->c_addrtype) if (a->c_addrtype != b->c_addrtype)