Unfortunately this was not explicitly documented and thus might be risky. But all uses I could find in FFmpeg and one in VLC had a memleak in these cases, and I could not find any that relied on the previous behaviour.
Unified · Split
| @@ -15,6 +15,11 @@ libavutil: 2014-08-09 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2014-08-23 - xxxxxxx - lavu 54.7.100 - dict.h | |
| 19 | + AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL arguments are now | |
| 20 | + freed even on error. This is consistent with the behaviour all users | |
| 21 | + of it we could find expect. | |
| 22 | + | |
| 18 | 23 | 2014-08-21 - 980a5b0 - lavu 54.6.100 - frame.h motion_vector.h |
| 19 | 24 | Add AV_FRAME_DATA_MOTION_VECTORS side data and AVMotionVector structure |
| 20 | 25 | |
| @@ -126,6 +126,8 @@ err_out: · 125 unmodified lines | ||
| 126 | 126 | av_free(m->elems); |
| 127 | 127 | av_freep(pm); |
| 128 | 128 | } |
| 129 | + if (flags & AV_DICT_DONT_STRDUP_KEY) av_free(key); | |
| 130 | + if (flags & AV_DICT_DONT_STRDUP_VAL) av_free(value); | |
| 129 | 131 | return AVERROR(ENOMEM); |
| 130 | 132 | } |
| 131 | 133 | |
| @@ -115,6 +115,9 @@ int av_dict_count(const AVDictionary *m); · 114 unmodified lines | ||
| 115 | 115 | /** |
| 116 | 116 | * Set the given entry in *pm, overwriting an existing entry. |
| 117 | 117 | * |
| 118 | + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, | |
| 119 | + * these arguments will be freed on error. | |
| 120 | + * | |
| 118 | 121 | * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL |
| 119 | 122 | * a dictionary struct is allocated and put in *pm. |
| 120 | 123 | * @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 · 6 unmodified lines | ||
| 127 | 130 | /** |
| 128 | 131 | * Convenience wrapper for av_dict_set that converts the value to a string |
| 129 | 132 | * and stores it. |
| 133 | + * | |
| 134 | + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error. | |
| 130 | 135 | */ |
| 131 | 136 | int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); |
| 132 | 137 | |
| @@ -56,7 +56,7 @@ · 55 unmodified lines | ||
| 56 | 56 | */ |
| 57 | 57 | |
| 58 | 58 | #define LIBAVUTIL_VERSION_MAJOR 54 |
| 59 | −#define LIBAVUTIL_VERSION_MINOR 6 | |
| 59 | +#define LIBAVUTIL_VERSION_MINOR 7 | |
| 60 | 60 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 61 | 61 | |
| 62 | 62 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |