This code can't possibly work

Qualcomm / Eng
oRXf54

Go to company page Qualcomm Eng

PRE
Viasat Inc.
oRXf54
Mar 23 11 Comments

I was working on unit test today and realized I needed to do something I had done before in another unit test. I went reference it and maybe move it to a common function and discovered someone else had replaced it with something nonsensical.

I can't share the exact code obviously, but it essentially a for loop controlled by magic numbers that allocates an object into a global variable inside the loop then overwrites the pointer on the next iteration. I think it's a typedef of a shared pointer, so it might just barely not be a memory leak.

I wondered how this got through code review, so I looked and it was some > 1,000 line change by someone from another team. However, 2 people from my team gave this change approval.

What?

TC 180K

47 PARTICIPANTS SELECT ONLY ONE ANSWER
VOTE VIEW RESULT

comments

Want to comment? LOG IN or SIGN UP
TOP 11 Comments