da_cow (she/her)@feddit.org to Programmer Humor@programming.dev · 5 days agoI got to avoid memory management for quite some timefeddit.orgimagemessage-square65linkfedilinkarrow-up1336arrow-down112file-text
arrow-up1324arrow-down1imageI got to avoid memory management for quite some timefeddit.orgda_cow (she/her)@feddit.org to Programmer Humor@programming.dev · 5 days agomessage-square65linkfedilinkfile-text
Finally I have a valid reason to learn about memory management. It was also hella weird when encountering it.
minus-squareda_cow (she/her)@feddit.orgOPlinkfedilinkarrow-up8·5 days agoI found the mistake. Since the country code char array only has a size of 2 it overwrites the \0 char causing the memory to leak.
minus-squaresilasmariner@programming.devlinkfedilinkarrow-up16·5 days agoUsually what’s meant by a memory leak is memory that’s allocated but never freed. Writing outside of array allocation would usually be considered an overflow. Which sounds kinda similar but is not the same.
minus-squarehenfredemars@infosec.publinkfedilinkEnglisharrow-up1·5 days agoBingo. I thought something probably happened to your terminator.
I found the mistake. Since the country code char array only has a size of 2 it overwrites the \0 char causing the memory to leak.
Usually what’s meant by a memory leak is memory that’s allocated but never freed. Writing outside of array allocation would usually be considered an overflow. Which sounds kinda similar but is not the same.
Bingo. I thought something probably happened to your terminator.