[lttng-dev] [PATCH] list.c : enforce error behaviour of get_cmdline_by_pid()

Thibault, Daniel Daniel.Thibault at drdc-rddc.gc.ca
Mon Feb 13 13:47:55 EST 2012


>From dfaf81c407e69d3a7becf3f2b3c1d6aa979bbd0b Mon, 13 Feb 2012 13:46:30 -0500
From: Daniel U. Thibault <daniel.thibault at drdc-rddc.gc.ca>
Date: Mon, 13 Feb 2012 13:46:03 -0500
Subject: [PATCH] list.c : enforce error behaviour of get_cmdline_by_pid()

Signed-off-by: Daniel U. Thibault <daniel.thibault at drdc-rddc.gc.ca>

diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c
index 9375838..322f695 100644
--- a/src/bin/lttng/commands/list.c
+++ b/src/bin/lttng/commands/list.c
@@ -115,6 +115,8 @@
 	ret = fread(cmdline, 1, PATH_MAX, fp);
 	if (ret < 0) {
 		perror("fread proc list");
+		free(cmdline);
+		cmdline = NULL;
 	}
 	fclose(fp);
------------------------------

Daniel U. Thibault
R & D pour la défense Canada - Valcartier (RDDC Valcartier) / Defence R&D Canada - Valcartier (DRDC Valcartier)
Système de systèmes (SdS) / System of Systems (SoS)
Solutions informatiques et expérimentations (SIE) / Computing Solutions and Experimentations (CSE)
2459 Boul. Pie XI Nord
Québec, QC  G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC: 918V QSDJ
Gouvernement du Canada / Government of Canada
<http://www.valcartier.drdc-rddc.gc.ca/>



More information about the lttng-dev mailing list