Re: Memory leak
- From: Bijoy Chandrasekharan <bijoy_mc yahoo co in>
- To: Rajesh Padalia <rpadalia qatar net qa>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: Memory leak
- Date: Sat, 30 Nov 2002 10:07:13 +0530
**********************from glib API
g_strdup_printf ()
gchar* g_strdup_printf (const gchar *format,
...);
Similar to the standard C sprintf() function but safer, since it
calculates the maximum space required and allocates memory to hold the
result. The returned string should be freed when no longer needed.
************************************************
Hi Rajesh,
you can 'g_strdup_printf' to a local variable and compre it with
'Config' and freee that variable after use.
hope this helps
bijoy.
while (!feof(fconfig)) {
fgets(Config, 60, fconfig);
if (!feof(fconfig)) {
if (g_strcasecmp(Search_clist_col[3], "COMPND") != 0) {
if (g_strcasecmp(Config, g_strdup_printf("NAME = %s:%s\n",
Search_clist_col[1], Search_clist_col[2]))
== 0) {
CompdFound = TRUE;
}
}
else {
if (g_strcasecmp(Config, g_strdup_printf("NAME = %s\n",
Search_clist_col[1])) == 0) {
CompdFound = TRUE;
Search_clist_col[2] = g_strdup(" ");
}
}
if ((strstr(Config, g_strdup_printf(" %-7s= ",
Parameter)))&&(CompdFound == TRUE)) {
Parameter_Value = g_strsplit(Config, "=", 1);
g_strstrip(Parameter_Value[1]);
CompdFound = FALSE;
break;
}
________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
visit http://in.tv.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]