Re: g_strstrip question.



I think you'll find that 'b' is a new piece of memory and so is 'c', therefore, you were right the first time in stating each variable would have to be freed. I am curious about one thing though, if g_strstrip is a DEFINITION of a combination of g_strchug and g_strchop, that in it's self should be a memory leak shouldn't it?

   gchar *a = NULL;
   gchar *b = NULL;
   gchar *c = NULL;

   a = g_strdup("   mystring   ");
   b = g_strchug(a);
   c = g_strchop(b);

   /* WHERE c is now the string u want */

   if(a != NULL) g_free(a);
   if(b != NULL) g_free(b);
   if(c != NULL) g_free(c);

Martyn





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