From: Florian G. <re...@us...> - 2007-04-19 23:09:13
|
Update of /cvsroot/perfparse/_perfparse/db_tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30555/db_tools Modified Files: convert.c Log Message: Fixed mem leak Index: convert.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/db_tools/convert.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** convert.c 19 Apr 2007 12:38:26 -0000 1.33 --- convert.c 19 Apr 2007 23:09:12 -0000 1.34 *************** *** 200,210 **** int Hid,Sid; - // use combined string for querying cache - GString *gsCombined=g_string_new(""); - g_string_printf(gsCombined,"%s : %s",host_name,service_desc); - if((Hid=get_hostId_from_name(host_name,p_db_mysql_new))==FALSE) { return(FALSE); } if((pSid=g_hash_table_lookup(servicesCache,gsCombined->str))) { --- 200,210 ---- int Hid,Sid; if((Hid=get_hostId_from_name(host_name,p_db_mysql_new))==FALSE) { return(FALSE); } + + // use combined string for querying cache + GString *gsCombined=g_string_new(""); + g_string_printf(gsCombined,"%s : %s",host_name,service_desc); if((pSid=g_hash_table_lookup(servicesCache,gsCombined->str))) { *************** *** 213,216 **** --- 213,217 ---- printw("\nServiceId Cache Hit: %s -> %d\n",gsCombined->str,Sid);refresh(); #endif + g_string_free(gsCombined,TRUE); return(Sid); } else { *************** *** 250,261 **** int Sid,Mid; // use combined string for querying cache GString *gsCombined=g_string_new(""); g_string_printf(gsCombined,"%s : %s : %s",host_name,service_desc,metric); - if((Sid=get_serviceId_from_desc(host_name,service_desc,p_db_mysql_new))==FALSE) { - return(FALSE); - } - if((pMid=g_hash_table_lookup(metricCache,gsCombined->str))) { Mid=*pMid; --- 251,262 ---- int Sid,Mid; + if((Sid=get_serviceId_from_desc(host_name,service_desc,p_db_mysql_new))==FALSE) { + return(FALSE); + } + // use combined string for querying cache GString *gsCombined=g_string_new(""); g_string_printf(gsCombined,"%s : %s : %s",host_name,service_desc,metric); if((pMid=g_hash_table_lookup(metricCache,gsCombined->str))) { Mid=*pMid; *************** *** 263,266 **** --- 264,268 ---- printw("\nMetricId Cache Hit: %s -> %d\n",gsCombined->str,Mid);refresh(); #endif + g_string_free(gsCombined,TRUE); return(Mid); } else { *************** *** 853,857 **** } ! printw(_("Copying entry: %d/%d (%.2f %%) Elapsed: %d h, %d min, %d sec Est. remaining: %d h, %d min, %d sec\n"), i,iODBnumrows,(float) i/iODBnumrows,eh,emin,esec,h,min,sec); refresh(); } --- 855,861 ---- } ! printw(_("Copying entry: %d/%d (%.2f %%) Elapsed: %d h, %d min, %d sec " ! "Est. remaining: %d h, %d min, %d sec\n"), i,iODBnumrows, ! (float) i/iODBnumrows*100,eh,emin,esec,h,min,sec); refresh(); } |