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

Michael Niedermayer michaelni at gmx.at
Sun Jun 28 18:32:42 CEST 2015


On Sun, Jun 28, 2015 at 05:47:51PM +0200, Nicolas George wrote:
> Le decadi 10 messidor, an CCXXIII, Michael Niedermayer a écrit :
> > This avoids the need to print such warning in all callers
> 
> I believe this is a bad idea: the warning will be duplicated when callers
> already include them.

we have 440 matches of av_dict_set() in the code base (grep wise)
and some more grep to reduce that and manual counting indicates about
37 which check their return value

if we print the warning at a central place theres less than 37
av_log() warnings to remove

if we want to add warnings and checks to all, that would be more on
the order of 400 changes


> 
> There are low-level APIs that return an error and high-level APIs that print
> error messages. Changing the status of an API is not a good idea. Creating a
> new API is the way to go.

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

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150628/044dde9b/attachment.asc>


More information about the ffmpeg-devel mailing list