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:32:48 +0000 (12:32 -0400)
commit9b234cd0975696f1379ddd1c85ae50f9e601e93d
tree558b9e7b5e15603a048b509e2c36ace4d2f5f252
parent33c3d1065dd483303351a495f1c49939a86bcefd
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.024504 seconds and 4 git commands to generate.