Closed elfring closed 5 years ago
The return value of malloc
is already checked anywhere the src/alloc.h header is included (see src/alloc.h:37). I might as well add a similar check to the call to fwrite.
Added in ce800c8.
There are other calls to fwrite
, but they should just be going to stdout/stderr. I'm not sure detecting errors there is worthwhile.
The return value of malloc is already checked
Would it be clearer to use your own function names directly instead of the applied renaming?
I suggest to avoid ignorance of return values a bit more. Would you like to detect every error situation as early as possible?
It may be slightly clearer, but I think it also makes the code harder to read. I only added those checks because of the WebAssembly target, where malloc
failure actually happens somewhat frequently—on other platforms it's less of a concern.
Would you like to add more error handling for return values from functions like the following?