fprintf: Fix up decrementing recursivity level in type__fprintf()

In some exit paths we were accessing tconf before we had copied it from
conf, and we also were losing track of the original type that could have
been expanded and where we bumped the recursivity level member, so just
store that original type and if it is set, decrement its recursivity
level.

This addresses these coverity report entries:

  Error: UNINIT (CWE-457): [#def21]
  dwarves-1.13/dwarves_fprintf.c:600: var_decl: Declaring variable "tconf" without initializer.
  dwarves-1.13/dwarves_fprintf.c:774: uninit_use: Using uninitialized value "tconf.expand_types".
  #  772|   	}
  #  773|   out:
  #  774|-> 	if (tconf.expand_types)
  #  775|   		--type->recursivity_level;
  #  776|

  Error: FORWARD_NULL (CWE-476): [#def22]
  dwarves-1.13/dwarves_fprintf.c:605: var_compare_op: Comparing "type" to null implies that "type" might be null.
  dwarves-1.13/dwarves_fprintf.c:775: var_deref_op: Dereferencing null pointer "type".
  #  773|   out:
  #  774|   	if (tconf.expand_types)
  #  775|-> 		--type->recursivity_level;
  #  776|
  #  777|   	return printed;

Reported-by: William Cohen <wcohen@redhat.com>
Fixes: f84bf73d54d0 ("dwarves: Move the fprintf code to a new source file.")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed