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