[lttng-dev] [PATCH lttng-tools] Fix: leak on error in lttng-crash

Jérémie Galarneau jeremie.galarneau at efficios.com
Fri Mar 27 16:20:45 EDT 2015


Merged, thanks!

Jérémie

On Fri, Mar 27, 2015 at 3:52 PM, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> Found by Coverity:
> ** CID 1291945:  Resource leaks  (RESOURCE_LEAK)
> /src/bin/lttng-crash/lttng-crash.c: 769 in copy_crash_data()
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
>  src/bin/lttng-crash/lttng-crash.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/bin/lttng-crash/lttng-crash.c b/src/bin/lttng-crash/lttng-crash.c
> index 793877d..4f1efe9 100644
> --- a/src/bin/lttng-crash/lttng-crash.c
> +++ b/src/bin/lttng-crash/lttng-crash.c
> @@ -766,7 +766,8 @@ int copy_crash_data(const struct lttng_crash_layout *layout, int fd_dest,
>         readlen = lttng_read(fd_src, buf, src_file_len);
>         if (readlen < 0) {
>                 PERROR("Error reading input file");
> -               return -1;
> +               ret = -1;
> +               goto end;
>         }
>
>         prod_offset = crash_get_field(layout, buf, prod_offset);
> --
> 2.1.4
>



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list