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`.

refs #794