[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: CVS update: i_basic.nw



  User: cnieves 
  Date: 05/09/30 16:33:22

  Modified:    .        i_basic.nw
  Log:
  Fixed memory leak. See changelog for more details.
  
  
  
  
  Revision  Changes    Path
  1.21      +19 -12    eda/geda/devel/gschem/noweb/i_basic.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: i_basic.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/i_basic.nw,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -b -r1.20 -r1.21
  --- i_basic.nw	27 Sep 2005 22:36:57 -0000	1.20
  +++ i_basic.nw	30 Sep 2005 20:33:22 -0000	1.21
  @@ -235,14 +235,16 @@
   
     /* This may be a memory leak... either way it's weird and -Wall is */
     /* complaining... */
  -  buf = NULL;
  +  buf = g_strdup("");
     aux = buf;
   
  +  if ( message != NULL) {
     if ( message && message[0] ) {
       buf = g_strdup_printf("%s - ", message);
       if (aux) free(aux);
       aux = buf;
     }
  +  }
   
     if ( !w_current->snap ) {
       buf = g_strdup_printf("%s%s - ", buf, _("Snap Off"));
  @@ -256,6 +258,7 @@
       aux = buf;
     }
   
  +  if (buf != NULL) {
     if (strlen(buf) > 0) {
       buf = g_strdup_printf("%s%s", buf, state_string);
       if (aux) free(aux);
  @@ -264,9 +267,13 @@
     } else {
       what_to_say = state_string;
     }
  +  }
  +  else {
  +    what_to_say = state_string;
  +  }
   
     i_update_status(w_current, what_to_say);
  -  if(buf) free(buf);
  +  free(buf);
   }