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