diff --git a/doc/APIchanges b/doc/APIchanges index 2657470b6d63539dda97b6b839365f8e441faaef..5dde605fd08e2eb310958431807bbb1ec9c506a0 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,11 @@ libavutil: 2014-08-09 API changes, most recent first: +2014-08-23 - xxxxxxx - lavu 54.7.100 - dict.h + AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL arguments are now + freed even on error. This is consistent with the behaviour all users + of it we could find expect. + 2014-08-21 - 980a5b0 - lavu 54.6.100 - frame.h motion_vector.h Add AV_FRAME_DATA_MOTION_VECTORS side data and AVMotionVector structure diff --git a/libavutil/dict.c b/libavutil/dict.c index c17ce7a3cbd0663e11ef3d5427eb01c580f2269f..bdb56908d38d4faf056343e980420a0805b9ba35 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -126,6 +126,8 @@ err_out: av_free(m->elems); av_freep(pm); } + if (flags & AV_DICT_DONT_STRDUP_KEY) av_free(key); + if (flags & AV_DICT_DONT_STRDUP_VAL) av_free(value); return AVERROR(ENOMEM); } diff --git a/libavutil/dict.h b/libavutil/dict.h index 06f1621d4533fd00ff05bfdf2387527ab093ead0..9b3381b8284721a10c94ef798278e64ad944442e 100644 --- a/libavutil/dict.h +++ b/libavutil/dict.h @@ -115,6 +115,9 @@ int av_dict_count(const AVDictionary *m); /** * Set the given entry in *pm, overwriting an existing entry. * + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, + * these arguments will be freed on error. + * * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL * a dictionary struct is allocated and put in *pm. * @param key entry key to add to *pm (will be av_strduped depending on flags) @@ -127,6 +130,8 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags /** * Convenience wrapper for av_dict_set that converts the value to a string * and stores it. + * + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error. */ int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); diff --git a/libavutil/version.h b/libavutil/version.h index 4236ed24fdf5dedc1d21938e8d11c94df34a018b..8311cddce00ff3c5f10bdc0ef0994d606d89c902 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -56,7 +56,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 54 -#define LIBAVUTIL_VERSION_MINOR 6 +#define LIBAVUTIL_VERSION_MINOR 7 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \