|
|
|
|
|
by mjschultz
4188 days ago
|
|
In a chapter about deconstructing someone else's book, your own book also does dangerous things according to yourself: > The problem is, as with every book with code ever in the universe, beginners will copy that code out and use it somewhere else and then the function is wrong. Yet, if a beginner copied some of the code in this chapter they'd have the exact bug you are talking about here (using the NULL pointer returned from malloc()). I think you should probably expand that into the safer checks (don't forget to free(line) if longest is NULL too!). |
|