Use g_autoptr in inhibitor lock code

Instead of doing manual memory management, use g_autoptr, because
it doing it manually is error prone.
Also use g_autoptr for the GError "error" and the GUnixFDList "fds"
which both were leaked before.
1 job from master in 2 minutes and 53 seconds (queued for 2 seconds)
latest
Status Job ID Name Coverage
  Build
passed #95114
test

00:02:53