From: octo Date: Wed, 5 Apr 2006 10:59:21 +0000 (+0000) Subject: Added note where to free allocated memory. X-Git-Tag: liboping-0.1.0~125 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1a56986ce94174477249a79f57da192f4ea43b63;p=collectd.git Added note where to free allocated memory. Removed unneccesary and possibly confusing pointer. --- diff --git a/src/cpu.c b/src/cpu.c index 74faf09a..ad0816d8 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -114,6 +114,7 @@ static void cpu_init (void) port_host = mach_host_self (); + /* FIXME: Free `cpu_list' if it's not NULL */ if ((status = host_processors (port_host, &cpu_list, &cpu_list_len)) != KERN_SUCCESS) { syslog (LOG_ERR, "cpu-plugin: host_processors returned %i\n", (int) status); @@ -199,7 +200,6 @@ static void cpu_read (void) kern_return_t status; processor_cpu_load_info_data_t cpu_info; - processor_cpu_load_info_t cpu_info_ptr; mach_msg_type_number_t cpu_info_len; host_t cpu_host; @@ -207,12 +207,11 @@ static void cpu_read (void) for (cpu = 0; cpu < cpu_list_len; cpu++) { cpu_host = 0; - cpu_info_ptr = &cpu_info; cpu_info_len = sizeof (cpu_info); if ((status = processor_info (cpu_list[cpu], PROCESSOR_CPU_LOAD_INFO, &cpu_host, - (processor_info_t) cpu_info_ptr, &cpu_info_len)) != KERN_SUCCESS) + (processor_info_t) &cpu_info, &cpu_info_len)) != KERN_SUCCESS) { syslog (LOG_ERR, "processor_info failed with status %i\n", (int) status); continue;