]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: thread history funcname shouldn't be constant, it's freed
authorPaul Jakma <paul@quagga.net>
Mon, 11 Jan 2010 16:30:45 +0000 (16:30 +0000)
committerPaul Jakma <paul@quagga.net>
Wed, 8 Dec 2010 16:53:09 +0000 (16:53 +0000)
* thread.h: (struct cpu_thread_history.funcname) malloc gets called on this
  so it should not be const
* thread.c: (cpu_record_print) cast the (const char *) to (char *), this
  function knows what it's doing (free wont be called on it).

lib/thread.c
lib/thread.h

index e89af541c61f7ddaaa1709d4bb5e444f775785d0..af52b057a6f6b4c546392125d5cb05ebe18908b4 100644 (file)
@@ -303,7 +303,7 @@ cpu_record_print(struct vty *vty, thread_type filter)
   void *args[3] = {&tmp, vty, &filter};
 
   memset(&tmp, 0, sizeof tmp);
-  tmp.funcname = "TOTAL";
+  tmp.funcname = (char *)"TOTAL";
   tmp.types = filter;
 
 #ifdef HAVE_RUSAGE
index b52bc541d6fcb53860121cc9647cc9ea592d7c72..937bedbb30d340b013c7d96fe7f36c761d7b5a1b 100644 (file)
@@ -82,7 +82,7 @@ struct thread
 struct cpu_thread_history 
 {
   int (*func)(struct thread *);
-  const char *funcname;
+  char *funcname;
   unsigned int total_calls;
   struct time_stats
   {