• Andreas Rheinhardt's avatar
    avutil/opt: Avoid av_strdup(NULL) · aa7d6520
    Andreas Rheinhardt authored
    It is not documented to be safe and in any case it is nonsense:
    Currently av_strdup(NULL) returns NULL and in order to distinguish
    this from a genuine allocation failure, opt_copy_elem()
    checked afterwards whether src was actually NULL. But then one
    can simply check in advance whether one should call av_strdup()
    at all.
    set_string() was even worse and returned ENOMEM in case the value
    to be duplicated is NULL; this only worked because
    av_opt_set_defaults2() does not check the return value at all
    (given that it can't propagate it).
    
    These two places account for 389114 of 390356 av_strdup(NULL)
    calls during one FATE run.
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
    aa7d6520
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...