GH-179: Remove strdup and use Opt pattern.

Remove the use of strdup and associated frees and use the opt pattern.

Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>