Fixes segfault described in #794

Fixes bug in sys_semaphore_create() when a NULL pointer address is
passed in sem or attr.

Fixes bug in sys_semaphore_get_value() when a NULL pointer address is
passed in count.
Merge pull request #860 from devmapal/master

Fixes segfault described in #794