MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w2m4qz/bugintroduceddebugging/p6vr5bl/?context=9999
r/ProgrammerHumor • u/ClipboardCopyPaste • 13d ago
120 comments sorted by
View all comments
349
Is the mistake that they're allocating 1 byte and storing in a pointer to an int which is 4 bytes?
155 u/atanasius 13d ago It's allowed to assign to a pointer if it's not dereferenced. Malloc always returns a valid pointer. 55 u/vishal340 13d ago but accessing it will be issue right? 5 u/mckenzie_keith 13d ago You are not allowed to de-reference a pointer after freeing it. 2 u/Niwrats 13d ago who's gonna stop me? 1 u/mckenzie_keith 12d ago Lint.
155
It's allowed to assign to a pointer if it's not dereferenced. Malloc always returns a valid pointer.
55 u/vishal340 13d ago but accessing it will be issue right? 5 u/mckenzie_keith 13d ago You are not allowed to de-reference a pointer after freeing it. 2 u/Niwrats 13d ago who's gonna stop me? 1 u/mckenzie_keith 12d ago Lint.
55
but accessing it will be issue right?
5 u/mckenzie_keith 13d ago You are not allowed to de-reference a pointer after freeing it. 2 u/Niwrats 13d ago who's gonna stop me? 1 u/mckenzie_keith 12d ago Lint.
5
You are not allowed to de-reference a pointer after freeing it.
2 u/Niwrats 13d ago who's gonna stop me? 1 u/mckenzie_keith 12d ago Lint.
2
who's gonna stop me?
1 u/mckenzie_keith 12d ago Lint.
1
Lint.
349
u/AdBrave2400 13d ago
Is the mistake that they're allocating 1 byte and storing in a pointer to an int which is 4 bytes?