lkml.org 
[lkml]   [2015]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC/PATCH 17/38] perf tools: Maintain map groups list in a leader thread
On Fri, Oct 02, 2015 at 02:18:58PM +0900, Namhyung Kim wrote:

SNIP

> +static int thread__clone_map_groups(struct thread *thread,
> + struct thread *parent);
> +
> int __thread__set_comm(struct thread *thread, const char *str, u64 timestamp,
> bool exec)
> {
> @@ -182,6 +257,40 @@ int __thread__set_comm(struct thread *thread, const char *str, u64 timestamp,
> unwind__flush_access(thread);
> }
>
> + if (exec) {
> + struct machine *machine;
> +
> + BUG_ON(thread->mg == NULL || thread->mg->machine == NULL);
> +
> + machine = thread->mg->machine;
> +
> + if (thread->tid != thread->pid_) {
> + struct map_groups *old = thread->mg;
> + struct thread *leader;
> +
> + leader = machine__findnew_thread(machine, thread->pid_,
> + thread->pid_);
> +
> + /* now it'll be a new leader */
> + thread->pid_ = thread->tid;
> +
> + thread->mg = map_groups__new(old->machine);
> + if (thread->mg == NULL)
> + return -ENOMEM;

hum, isn't this leaking thread->mg ?
should we call map_groups__put(old) at the end of block?


jirka


\
 
 \ /
  Last update: 2015-10-08 15:21    [W:0.137 / U:0.860 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site