Skip to content

Files

Latest commit

 

History

History
11 lines (6 loc) · 577 Bytes

useAutoPointerMalloc.md

File metadata and controls

11 lines (6 loc) · 577 Bytes

Pattern: Use of auto_ptr for pointers obtained with malloc

Issue: -

Description

Object pointed by an auto_ptr is destroyed using operator delete. You should not use auto_ptr for pointers obtained with function malloc. This means that you should only use auto_ptr for pointers obtained with operator new. This excludes use C library allocation functions (for example malloc), which must be deallocated by the appropriate C library function.

Further Reading