Comment by codedokode

2 months ago

The bug was about the case when malloc returns null, but the library doesn't check for it.

Correct, but the point is that it is difficult to get malloc to return null on Linux. Why litter your code with checks for de facto impossible scenarios?

  • in systems level programming (the introductory course before operating systems in our university) this was one of the first misconceptions to be eradicated. you cannot trust malloc to return null.

  • First, Linux has thousands of settings that could affect this, second the library probably works not only on Linux.