Here's what I've noticed so far. There are probably more issues.
- We're not freeing the pcmk__common_args_t objects that we're allocating with pcmk__new_common_args(). (Edit: The GOptionContext actually takes ownership of this object, and it gets freed by free_common_args() when the context is freed.)
- We're not freeing the file-scope variables stylesheet_link and title in output_html.c, which get allocated by the GOption parser. Also:
- The strings should be gchar * instead of char *. When we free them, we should use g_free().
- These values should be associated with a pcmk__output_t object. There should not be one fixed set of values for the whole process.
- The common_args argument to pcmk__build_arg_context() would be an intuitive place to store these values. However, this would require some refactoring to make it possible.
- pcmk__html_add_header() is adding to a global headers list in output_html.c. It really should be adding to a list in a particular pcmk__output_t object.