Use NULL instead of 0 for pointers.
The malloc will return a pointer to the allocated memory if successful, otherwise a NULL pointer is returned.
This commit is contained in:
parent
2d4e18c4c2
commit
27f4c84ae1
@ -82,7 +82,7 @@ read_buf(FILE *fp, off_t off, size_t len)
|
||||
}
|
||||
|
||||
buf = malloc(len);
|
||||
if (buf == 0) {
|
||||
if (buf == NULL) {
|
||||
warn("cannot malloc %zd bytes of memory", len);
|
||||
return (NULL);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user