Code Fix

上級free(): double free detected in tcache の原因と直し方 › パターン3

free(): double free detected in tcache の原因と直し方

同じポインタに対してfree()を2回呼び出したときに検出されるエラーです。

 1  #include <stdio.h>
 2  #include <stdlib.h>
 3  
 4  int main(void) {
 5      char *buf = malloc(16);
 6      free(buf);
 7      _____________________
                  ^
 8      return 0;
 9  }
free(): double free detected in tcache 2 Aborted

空欄を埋めてコンパイル・実行を通す

広告
広告スロット(未設定)

free(): double free detected in tcache の原因と直し方

メモリ管理システムが不整合を検知して強制終了します。

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)