lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 24 Apr 2012 10:07:49 +0900
From:	Namhyung Kim <namhyung.kim@....com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Namhyung Kim <namhyung@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...nel.org>,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Borislav Petkov <bp@...en8.de>,
	David Ahern <dsahern@...il.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH v2] parse-events: Free flag/sym field on failure path

If parsing flag/sym field failed after allocating it, it
should be freed. As Steven advises, make the field NULL
and check it at out_free instead of adding more goto labels.

Signed-off-by: Namhyung Kim <namhyung.kim@....com>
---
 parse-events.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/parse-events.c b/parse-events.c
index bd078ba..3ccedd9 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -2147,6 +2147,7 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char **
 		if (test_type_token(type, token, EVENT_OP, "{"))
 			break;
 
+		field = NULL;
 		arg = alloc_arg();
 
 		free_token(token);
@@ -2199,6 +2200,10 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char **
 	return type;
 
 out_free:
+	if (field) {
+		free(field->value);
+		free(field);
+	}
 	free_arg(arg);
 	free_token(token);
 	*tok = NULL;
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ