From cc35a00a308ec94a5de04cfec390da313436cf1c Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 24 May 2010 14:48:17 +0200 Subject: [PATCH] Fix segmentation violation bug in freebsd.cc Last patch removed a needed strndup(). Signed-off-by: Alexander Graf Signed-off-by: Pavel Labath --- src/freebsd.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/freebsd.cc b/src/freebsd.cc index 5cae8f6d..318ac3ec 100644 --- a/src/freebsd.cc +++ b/src/freebsd.cc @@ -778,6 +778,7 @@ proc_find_top(struct process **cpu, struct process **mem, struct process **time) tmp = (process *) malloc(sizeof(struct process)); memcpy(tmp, &processes[i], sizeof(struct process)); + tmp->name = strndup(processes[i].name, text_buffer_size); ttmp = mem[i]; mem[i] = tmp; @@ -793,6 +794,7 @@ proc_find_top(struct process **cpu, struct process **mem, struct process **time) tmp = (process *) malloc(sizeof(struct process)); memcpy(tmp, &processes[i], sizeof(struct process)); + tmp->name = strndup(processes[i].name, text_buffer_size); ttmp = cpu[i]; cpu[i] = tmp; @@ -808,6 +810,7 @@ proc_find_top(struct process **cpu, struct process **mem, struct process **time) tmp = (process *) malloc(sizeof(struct process)); memcpy(tmp, &processes[i], sizeof(struct process)); + tmp->name = strndup(processes[i].name, text_buffer_size); ttmp = time[i]; time[i] = tmp;