opt: do not crash in av_set_options_string() if opts == NULL

Add missing NULL check, and update documentation accordingly.
This commit is contained in:
Stefano Sabatini 2011-06-19 02:49:04 +02:00
parent 15f03725ce
commit 141f03541b
3 changed files with 4 additions and 1 deletions

View File

@ -41,7 +41,7 @@
#define LIBAVUTIL_VERSION_MAJOR 51
#define LIBAVUTIL_VERSION_MINOR 9
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_MICRO 1
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \

View File

@ -521,6 +521,8 @@ int av_set_options_string(void *ctx, const char *opts,
{
int ret, count = 0;
if (!opts)
return 0;
while (*opts) {
if ((ret = parse_key_value_pair(ctx, &opts, key_val_sep, pairs_sep)) < 0)
return ret;

View File

@ -169,6 +169,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags);
* key. ctx must be an AVClass context, storing is done using
* AVOptions.
*
* @param opts options string to parse, may be NULL
* @param key_val_sep a 0-terminated list of characters used to
* separate key from value
* @param pairs_sep a 0-terminated list of characters used to separate