From 309fc9bf0c244ed47c4d7c3a47119e596a40eb73 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 27 Mar 2015 15:52:00 -0400 Subject: [PATCH] Fix: leak on error in lttng-crash MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Jérémie Galarneau --- 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 793877d9d..4f1efe96d 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.34.1