weird memory leak (SOLVED)

Started by
1 comment, last by NateDogg1848 18 years, 11 months ago
For some reason the following code is creating a memory leak according to the d3dx debugger in visual studio .net 2003. After commenting / uncommenting code i narrowed it to this block, and specifically to a call to my readstr function (which is essentially a call to fgets()). I use fgets() many other times in my engine with no issues. Any ideas??? // Get the indices readstr(f,buf); sscanf(buf,"%d faces",&m_pMesh.iNumIndices); m_pMesh.iNumIndices*=3; m_pMesh.pIndices = new int[m_pMesh.iNumIndices]; int a,b,c; for(e=0; e<m_pMesh.iNumIndices; e+=3) { //readstr(f,buf); fgets(buf,255,f); // <--------THIS IS THE LINE THAT DOES IT //sscanf(buf,"verts(%d %d %d)", &a, &b, &c); //m_pMesh.pIndices[e]=a; //m_pMesh.pIndices[e+1]=b; //m_pMesh.pIndices[e+2]=c; } [Edited by - NateDogg1848 on June 11, 2005 9:42:15 PM]
Advertisement
How big is buf? Is it a character array of size 255? That could be causing problems for you. Showing the entire code for the function could also help figure out the problem.

minerjr
Yeah buf is a 256 char array. But i figured out that this memory leak only happens when i try to load my skydome mesh so i'm assuming there is something wrong with the file. Everything else is fine, just a random issue.

This topic is closed to new replies.

Advertisement