Timeline for Memory leaks on unload
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 11, 2018 at 20:28 | vote | accept | 11223342124 | ||
Dec 10, 2018 at 16:35 | answer | added | Cliff B | timeline score: 1 | |
Dec 10, 2018 at 15:31 | comment | added | Blauelf |
Assigning to parameters is bad in case you need them later. Which you do at least in some case. Also, it's bad style, reducing readability. And you can't free NULL . What do you think should happen then? You never allocated a memory block at NULL , so what should be freed? (free(NULL) will just do nothing)
|
|
Dec 10, 2018 at 13:51 | comment | added | 11223342124 |
Can you tell me why children pointers shouldn't be freed directly (if they are NULL )?
|
|
Dec 10, 2018 at 13:43 | comment | added | 11223342124 | Yeah, i remember it, I was thinking about the problem whole day yesterday without success. I totally forgot about the assigning to parameters part (i don't know why it is bad, i will google it now :)) | |
Dec 10, 2018 at 13:31 | comment | added | Blauelf |
Please do not free any children directly (they should be freed by the recursively called function), and please do not assign to any parameters. You might remember my opinion from cs50.stackexchange.com/a/30728/12099 ;-)
|
|
Dec 10, 2018 at 12:39 | history | asked | 11223342124 | CC BY-SA 4.0 |