Motorola Solutions Interview Question

A buggy C++ code that has shared_ptr usage and memory leak on it. When to use weak_ptr.