With the information you provided it is difficult to conclude anything. I have the least doubt on either of the 2 because as such both are harmless. What I would suspect is what happens after those lines are executed, especially, the pszFileText one. It is possible you are allocating a ridiculous amount, and/or, writing excess of the bounds and such. Are you making sure you check for the values using debugger single stepping and making sure your code is executing all the right paths ?