On Fri, 15 Oct 2021 09:36:00 +0000
"Pattan, Reshma" <reshma.pat...@intel.com> wrote:

> > +   buf = calloc(1, len);
> > +   if (!buf)
> > +           return -1;  
> 
> How about returning -ENOMEM

It could but not necessary.
The other code is returning result of write and therefore would be -1 on
write error.

This is in internal local function and the only caller is just checking for < 0.

PS: In reality, malloc can't fail on Linux. Process gets oom killed instead
(unless someone has gone and tweaked the memory allocator to not overcommit).

Reply via email to