Fix: flt.lttng-utils.debug-info: memory leak
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 6 May 2019 20:22:03 +0000 (16:22 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 7 May 2019 16:20:38 +0000 (12:20 -0400)
commitbfe42dac12bfd6aba7159ee5935828a027468555
treeb40a3a4c03b06c9055589fdf366d2cac77f58a38
parent53dc85fa3e0012825e9f0128747f6f2fb54119d1
Fix: flt.lttng-utils.debug-info: memory leak

The gelf_getshdr() function return a pointer to the second parameter on
success and NULL on error. This means that on we overwrite the
`curr_section_hdr` variable and leak memory.

To fix it, we simply change the variable from a heap allocated variable
to a stack allocated variable this has the effect of making code simpler.

Found using scan-build:
  line 334, column 7
  Potential leak of memory pointed to by 'curr_section_hdr'

Report-by: scan-build (ad8e62)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I5cc4049075e4ca1d64d98e17662f935e6562bb6e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1265
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/lttng-utils/debug-info/bin-info.c
This page took 0.024981 seconds and 4 git commands to generate.