]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
use of g_free() cause heap damage on windows if memory is allocated by malloc().... 529/head
authorpetgit <mo1607bil>
Wed, 27 Aug 2014 19:52:53 +0000 (21:52 +0200)
committerpetgit <mo1607bil>
Wed, 27 Aug 2014 19:52:53 +0000 (21:52 +0200)
src/rrd_graph.c
win32/librrd-4.vcxproj

index b99d0beefd9c4a331e5b87556d43feb4c1f3d494..1d6518553baeacf49281dbbd07f735bfe2bb6fc1 100644 (file)
@@ -343,11 +343,7 @@ int im_free(
        }
 
        if (im->rrd_map){
-               //TODO: 
-               // check reason of error:
-               // Unhandled exception at 0x77BBF636 (ntdll.dll) in rrdtool.exe: 0xC0000374: a Heap was damaged (parameters: 0x77BDD338).       
-               // at following line
-               //g_hash_table_destroy(im->rrd_map);
+               g_hash_table_destroy(im->rrd_map);
        }
        
 
@@ -4307,7 +4303,8 @@ void rrd_graph_init(
     tzset();
 #endif
     im->gdef_map = g_hash_table_new_full(g_str_hash, g_str_equal,g_free,NULL);
-    im->rrd_map = g_hash_table_new_full(g_str_hash, g_str_equal,g_free,NULL);
+       //use of g_free() cause heap damage on windows. Key is allocated by malloc() in sprintf_alloc(), so free() must use
+    im->rrd_map = g_hash_table_new_full(g_str_hash, g_str_equal,free,NULL); 
     im->graph_type = GTYPE_TIME;
     im->base = 1000;
     im->daemon_addr = NULL;
index 9fc0551e564eda3162794c15daf8d21d6dba37f9..aebcd39a180aa53092f9131bcaeadf99542ecf05 100644 (file)
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <PrecompiledHeader />
-      <PrecompiledHeaderFile />
+      <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
       <ProgramDataBaseFileName>$(IntDir)librrd-4.pdb</ProgramDataBaseFileName>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
       <ProgramDataBaseFileName>$(IntDir)librrd-4.pdb</ProgramDataBaseFileName>
       <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <DebugInformationFormat>None</DebugInformationFormat>
       <CompileAs>CompileAsCpp</CompileAs>
       <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
     </ClCompile>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
       <PrecompiledHeader />
-      <PrecompiledHeaderFile />
+      <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
       <ProgramDataBaseFileName>$(IntDir)librrd-4.pdb</ProgramDataBaseFileName>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
       <PrecompiledHeader />
-      <PrecompiledHeaderFile />
+      <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <CompileAs>CompileAsCpp</CompileAs>
       <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <ProgramDataBaseFileName>$(IntDir)librrd-4.pdb</ProgramDataBaseFileName>
     </ClCompile>
     <Lib>
       <AdditionalDependencies>cairo.lib;pango-1.0.lib;pangocairo-1.0.lib;libpng.lib;zdll.lib;glib-2.0.lib;gobject-2.0.lib;libxml2.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
       <PrecompiledHeader />
-      <PrecompiledHeaderFile />
+      <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
       <ProgramDataBaseFileName>$(IntDir)librrd-4.pdb</ProgramDataBaseFileName>
       <WarningLevel>TurnOffAllWarnings</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>