From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel.Thibault@drdc-rddc.gc.ca (Thibault, Daniel) Date: Mon, 30 Jan 2012 16:39:50 -0500 Subject: [lttng-dev] [PATCH] lttng-tools add_context.c : Fixing memory leaks In-Reply-To: <4F27091A.80606@polymtl.ca> References: <3CA1A65C03C1A34C81BBC6272782E69680895F@valcartierex01.valcartier.drdc-rddc.gc.ca> <4F22FF2C.3060604@polymtl.ca> <3CA1A65C03C1A34C81BBC6272782E696808968@valcartierex01.valcartier.drdc-rddc.gc.ca> <4F26DD60.2090909@polymtl.ca> <3CA1A65C03C1A34C81BBC6272782E6968089DE@valcartierex01.valcartier.drdc-rddc.gc.ca> <4F27091A.80606@polymtl.ca> Message-ID: <3CA1A65C03C1A34C81BBC6272782E696808A00@valcartierex01.valcartier.drdc-rddc.gc.ca> -----Message d'origine----- Envoy??: 30 janvier 2012 16:18 > For some reason, this patch does not apply ... > > Applying: lttng-tools add_context.c : Fixing memory leaks > error: patch failed: src/bin/lttng/commands/add_context.c:520 > error: src/bin/lttng/commands/add_context.c: patch does not apply > > In the meantime, I've merge the others since there are not using > lttng/commands/add_context.c > > Also, this set of patch had a minor problem having > "lttng2-lttng-tools-2.0-pre18+-5c73c59/" added to all paths in the diff. Don't > know why because the previous one were fine... > > Please update your git head before resending this one, I've merge your latest > working patches. Concerning the added "lttng2-lttng-tools-2.0-pre18+-5c73c59/" path fragment, that's my bad: I was manually editing that out of last week's patches. As for the patch not applying, I guess we're getting out of sync again. But now that I've been told what the magic words Eclipse expects are (thanks Alexandre!), I should be able to get this back on track. Meanwhile I've got one more little patch ready so I might as well send it out: it simplifies the copy_string() calls of lttng_enable_event() and lttng_disable_event(). ------------------------------ >From 7d6f525e082259466cd58ef27670a40944445c65 Mon, 30 Jan 2012 16:29:56 -0500 From: Daniel U. Thibault Date: Mon, 30 Jan 2012 16:29:44 -0500 Subject: [PATCH] lttng-ctl : Simplify copy_string() of lttng_enable_event() and lttng_disable_event() Signed-off-by: Daniel U. Thibault diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 65aa3e3..fa901c7 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -515,13 +515,9 @@ } /* If no channel name, we put the default name */ - if (channel_name == NULL) { - copy_string(lsm.u.enable.channel_name, DEFAULT_CHANNEL_NAME, - sizeof(lsm.u.enable.channel_name)); - } else { - copy_string(lsm.u.enable.channel_name, channel_name, - sizeof(lsm.u.enable.channel_name)); - } + copy_string(lsm.u.enable.channel_name, + (channel_name ? channel_name : DEFAULT_CHANNEL_NAME), + sizeof(lsm.u.enable.channel_name)); copy_lttng_domain(&lsm.domain, &handle->domain); @@ -553,13 +549,9 @@ return -1; } - if (channel_name) { - copy_string(lsm.u.disable.channel_name, channel_name, - sizeof(lsm.u.disable.channel_name)); - } else { - copy_string(lsm.u.disable.channel_name, DEFAULT_CHANNEL_NAME, - sizeof(lsm.u.disable.channel_name)); - } + copy_string(lsm.u.disable.channel_name, + (channel_name ? channel_name : DEFAULT_CHANNEL_NAME), + sizeof(lsm.u.disable.channel_name)); copy_lttng_domain(&lsm.domain, &handle->domain); ------------------------------ 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