全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Dangling pointer, use after free, double free?

又称: dangling pointer · use after free · double free

Definition 5.3 University Computer Science — Year 1 · 第 5 章 — Dynamic Memory

After free(p), every pointer that held the block’s address is a dangling pointer: it still holds the number, but the block is no longer the program’s. Reading or writing through it is a use after free; passing it to free again is a double free. Both are undefined behaviour.

Freeing a block through one pointer leaves every other copy of its address dangling. Nothing in the pointers changes; only the block’s status does, which is why the error is invisible in the source.
Freeing a block through one pointer leaves every other copy of its address dangling. Nothing in the pointers changes; only the block’s status does, which is why the error is invisible in the source.
在原文中阅读 →