The `sd_path_lookup(3)` man page states that the returned string shall be `free(3)`'d but then doesn't do so in the example code. Also add basic error handling as well. (cherry picked from commit fee1863c) (cherry picked from commit 010770bb)