ALLJOYN-1712 Fixed possible NULL pointer dereference

Fixing possible NULL pointer dereferences that were identified by Klocwork.
Klocwork issues 1325 and 1327.