Code Room
Code reviewMediumcr-g170
Subject Double freeLevel Mid–Senior~25 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this C++ ownership hand-off with unique_ptr.

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
#include <memory> struct Node { int v; }; void sink(Node* n) {    // takes ownership and frees it    delete n;} void run() {    std::unique_ptr<Node> p = std::make_unique<Node>();    sink(p.get());}
Run or narrate your approach, then ask the coach.