Hacker News new | past | comments | ask | show | jobs | submit login

You can have situations like

https://github.com/bsenftner/kvs/blob/master/kvs/kvs.cpp#L72...

where it's then not clear why there is no call to

`kv.m_binarySize = byte_size`

after calling

`kv.mp_binaryData = (uint8_t)malloc( sizeof(uint8_t) byte_size );`

because it seems like `kv.mp_binaryData` will now have a different size than it had before. That is, there will be a mismatch. Though it should not affect the `free` call.

I hope I'm missing something because I just dealt with the code for around 5 minutes.




That m_binarySize should have been removed, nothing referenced it beyond it's own code. I knew it did not affect the free() call and left it. That entire KVS lib is a fine example of KISS, it's so small I can hold it in my head, and issues like that m_binarySize field are just left because they end up being nops.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: