registry: simplify strdup() error handling