2012-08-17 62 views
1

我的計劃是在第二輪崩潰在這條線:程序崩潰是由於在C糟糕的malloc

char* temp_directive = (char *)malloc(7); 

與此錯誤:

Critical error detected c0000374 
Windows has triggered a breakpoint in Maman14.exe. 

This may be due to a corruption of the heap, which indicates a bug in Maman14.exe or  any of the DLLs it has loaded. 

This may also be due to the user pressing F12 while Maman14.exe has focus. 

我不明白爲什麼,總是發生在第二次運行。 我試圖添加免費(temp_directive),但它沒有幫助

任何famailer與此問題?

+4

你能告訴我們完整的代碼嗎? – 2012-08-17 15:28:35

+0

爲什麼字節爲7個字節? – Razvan 2012-08-17 15:28:59

+1

這幾乎肯定是先前的「自由」或寫入存儲區域之外的結果。運行valgrind來查看它發生的位置。 – dasblinkenlight 2012-08-17 15:29:12

回答

1

發現問題,它是由不同的realloc引起的。感謝大家!