SDMC: Use unique_ptr instead of manual allocation to prevent memory leaks