[FFmpeg-devel] [PATCH] avutil/dict: Print warning in case av_dict_set() fails to allocate memory

Nicolas George george at nsup.org
Sun Jun 28 18:54:50 CEST 2015

Le decadi 10 messidor, an CCXXIII, Michael Niedermayer a écrit :
> i understand that but taking the burden off the caller to print an
> error for memory allocation failures seemed overall to be the
> correct thing to do in this case
> if thats not wanted iam happy to drop this patch, it was just a
> suggestion as it seemed like the right thing to do in this case and
> alot simpler than the other way around

Something I thought of after sending my first mail:

Printing a specific warning for a small memory allocation failure is
useless. Small memory allocations do not fail under normal circumstances,
due to over commit. And even if the circumstances make they do fail, a whole
lot of them will fail, making the output fail at best, corrupted at work,
and in any case, cluttering the log with specific places of failure is not

When a memory error happens, we must make sure to return ENOMEM immediately
and not dereference the pointer, but anything beyond that is useless.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150628/de147fd9/attachment.asc>

More information about the ffmpeg-devel mailing list