From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: [PATCH][kernelshark] trace-graph: Fix trace_seq free-before-use
Date: Sun, 5 Sep 2010 12:05:04 +0100 [thread overview]
Message-ID: <1283684704-5650-1-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
Commit e892161f731e958980fa977e2d7980f3cf0819ce changed trace_seq to
dynamically expand its buffer. In two instances the destroy function
was called too early, causing a freed s.buffer to be used.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
trace-graph.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/trace-graph.c b/trace-graph.c
index 44c1273..4e91fe8 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -1666,14 +1666,17 @@ static gint draw_event_label(struct graph_info *ginfo, gint i,
*/
ret = trace_graph_plot_display_last_event(ginfo, plot, &s,
convert_x_to_time(ginfo, p2-1));
- trace_seq_destroy(&s);
- if (!ret)
+ if (!ret) {
+ trace_seq_destroy(&s);
return p2;
+ }
layout = gtk_widget_create_pango_layout(ginfo->draw, s.buffer);
pango_layout_set_font_description(layout, font);
pango_layout_get_pixel_size(layout, &text_width, &text_height);
+ trace_seq_destroy(&s);
+
/* Lets see if we can print this info */
if (p2 < text_width)
start = 1;
@@ -1967,7 +1970,6 @@ static void draw_timeline(struct graph_info *ginfo, gint width)
convert_nano(time, &sec, &usec);
trace_seq_init(&s);
trace_seq_printf(&s, "%lu.%06lu", sec, usec);
- trace_seq_destroy(&s);
gdk_draw_line(ginfo->curr_pixmap, ginfo->draw->style->black_gc,
mid, height, mid, height + 5);
@@ -1978,6 +1980,7 @@ static void draw_timeline(struct graph_info *ginfo, gint width)
gdk_draw_layout(ginfo->curr_pixmap, ginfo->draw->style->black_gc,
mid - (w / 2), height+10, layout);
g_object_unref(layout);
+ trace_seq_destroy(&s);
}
}
--
1.7.1
next reply other threads:[~2010-09-05 11:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-05 11:05 Stefan Hajnoczi [this message]
2010-09-07 20:28 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1283684704-5650-1-git-send-email-stefanha@linux.vnet.ibm.com \
--to=stefanha@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®