Re: g_strstrip question.
- From: Brett Nash <nash nash nu>
- To: Harring Figueiredo <harringf yahoo com>
- Cc: gtk_list gtk gtk <gtk-app-devel-list gnome org>
- Subject: Re: g_strstrip question.
- Date: Fri, 6 Dec 2002 08:41:38 +1100
If so, how do I free the whole string so that I do not get memory leaks ?
If you have some string str1 which you need to free...
char *str1;
char *oldstr;
/* Replace this with however str1 is allocated */
str1 = g_strdup("Some random string");
/* Save a copy */
oldstr = str1;
str1 = g_strstrip(str1);
...
g_free(oldstr); /* str1 is now an invalid pointer */
str1 = oldstr = NULL; /* sanity */
Regards,
nash
--
Brett Nash <nash nash nu>
Sometimes it's better to light a flamethrower than curse the darkness.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]