메모리 안전성Memory safety

CWE-415 Double Free

같은 메모리를 두 번 해제하는 결함.The same memory is freed twice.

근본 원인 패턴Root-cause pattern

에러 처리 경로와 정상 경로가 각각 해제를 수행하거나, 소유권이 두 곳에 있다고 착각한다. 할당자 메타데이터가 오염되어 이후 할당이 겹칠 수 있다.Error and normal paths both free, or two owners believe they own the buffer. Allocator metadata gets corrupted so later allocations can overlap.

전형적인 패치Typical fix

단일 소유자 원칙, 해제 직후 NULL 대입, goto cleanup 패턴 정리.Single owner, null after free, consolidate cleanup paths.

0 편posts

아직 이 클래스의 글이 없습니다. 아래 패턴 요약으로 먼저 학습하세요.No posts in this class yet. Start with the pattern summary below.

✎ CWE-415 퀴즈 풀기Quiz on CWE-415