Code Room
Code reviewHardcr-g388
Subject Double freeLevel Senior–Staff~24 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this C++ cleanup code mixing shared_ptr with manual delete.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewcpp
std::shared_ptr<Buffer> buf = std::make_shared<Buffer>(4096);Buffer* raw = buf.get();// ... use ...delete raw;        // free early to reclaim memorybuf.reset();       // also drop the shared_ptr
Run or narrate your approach, then ask the coach.