Hacker News new | ask | show | jobs
by ir3k 1058 days ago
I looked into those points and:

1. `sfd` is now closed. This cost me an extra line of code tho so I had to improvise.

2. `j` was not initially -1 as even empty input contains one "\n" character. But it could go pass value of 0 underflowing the buffer when buffer contained only white space characters (like in case of single "\n"). This was corrected.

3. `h_addr_list[i]` about this one. I'm quite sure I took it from example in one of man pages. Anyway, I replaced it with `memcpy`.

I also tried to use valgrind. This is OFC my first step but I will continue my studies on detecting memory leaks in future projects.