Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
BigBoo23206y@electric-ghost I'm trying to figure out why, according to this flowchart, it's legal to do.
free(a);
free(b);
free(a);
But not
free(a);
free(a);
I know that it works this way, but can't find out why. -
BigBoo23206y@GMR516 I'm a rebel.
Was pretty sure I removed the first tag. But I'm willing to roll with being ambiguous. -
aritzh7536y@BigBoo neither of them should work, should they? You "should" get a double free error on both. At least if a != 0 anyway
-
aritzh7536y@BigBoo wow. It actually does. But it only happens for small mallocs (in my tests, sizeof(int)*30 or smaller), while for bigger allocations, both give a double free error. So many bugs will be hidden because of this...
-
BigBoo23206y@aritzh There's a lot of flaws with memory allocation in C. Which also can lead to security issues if not handled properly.
It's all a bit complicated. But very interesting to deep dive into.
Related Rants
-
aayusharyan10Why do people (Some devs too...) bloody hell think that devs have Hard time fixing the Semi Colon issue, we ha...
-
AlgoRythm13Military grade encryption: md5 Enterprise grade encryption: Base64
-
boombodies19Dev: Why do you have an identical if statement right below this one? Manager: Because I want the code to doub...
How malloc works? It's easy. Just follow this simple flowchart and you will understand in no time.
joke/meme
not a joke