Before this commit, AVIOContext is to be freed with a plain av_free(), which prevents us from adding any deeper structure to it. (cherry picked from commit 99684f3ae752fc8bfb44a2dd1482f8d7a3d8536d) Signed-off-by: James Almer <jamrial@gmail.com>
Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2015-08-28 · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | API changes, most recent first: | 16 | API changes, most recent first: |
| 17 | 17 | ||
| 18 | 2017-09-01 - xxxxxxx - lavf 57.80.100 / 57.11.0 - avio.h | ||
| 19 | Add avio_context_free(). From now on it must be used for freeing AVIOContext. | ||
| 20 | |||
| 18 | 2017-08-08 - xxxxxxx - lavu 55.74.100 - pixdesc.h | 21 | 2017-08-08 - xxxxxxx - lavu 55.74.100 - pixdesc.h |
| 19 | Add AV_PIX_FMT_FLAG_FLOAT pixel format flag. | 22 | Add AV_PIX_FMT_FLAG_FLOAT pixel format flag. |
| 20 | 23 | ||
| @@ -467,6 +467,14 @@ AVIOContext *avio_alloc_context( · 466 unmodified lines | |||
| 467 | int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), | 467 | int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
| 468 | int64_t (*seek)(void *opaque, int64_t offset, int whence)); | 468 | int64_t (*seek)(void *opaque, int64_t offset, int whence)); |
| 469 | 469 | ||
| 470 | /** | ||
| 471 | * Free the supplied IO context and everything associated with it. | ||
| 472 | * | ||
| 473 | * @param s Double pointer to the IO context. This function will write NULL | ||
| 474 | * into s. | ||
| 475 | */ | ||
| 476 | void avio_context_free(AVIOContext **s); | ||
| 477 | |||
| 470 | void avio_w8(AVIOContext *s, int b); | 478 | void avio_w8(AVIOContext *s, int b); |
| 471 | void avio_write(AVIOContext *s, const unsigned char *buf, int size); | 479 | void avio_write(AVIOContext *s, const unsigned char *buf, int size); |
| 472 | void avio_wl64(AVIOContext *s, uint64_t val); | 480 | void avio_wl64(AVIOContext *s, uint64_t val); |
| @@ -143,6 +143,11 @@ AVIOContext *avio_alloc_context( · 142 unmodified lines | |||
| 143 | return s; | 143 | return s; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | void avio_context_free(AVIOContext **ps) | ||
| 147 | { | ||
| 148 | av_freep(ps); | ||
| 149 | } | ||
| 150 | |||
| 146 | static void writeout(AVIOContext *s, const uint8_t *data, int len) | 151 | static void writeout(AVIOContext *s, const uint8_t *data, int len) |
| 147 | { | 152 | { |
| 148 | if (!s->error) { | 153 | if (!s->error) { |
| @@ -1123,7 +1128,9 @@ int avio_close(AVIOContext *s) · 974 unmodified lines | |||
| 1123 | else | 1128 | else |
| 1124 | av_log(s, AV_LOG_DEBUG, "Statistics: %"PRId64" bytes read, %d seeks\n", s->bytes_read, s->seek_count); | 1129 | av_log(s, AV_LOG_DEBUG, "Statistics: %"PRId64" bytes read, %d seeks\n", s->bytes_read, s->seek_count); |
| 1125 | av_opt_free(s); | 1130 | av_opt_free(s); |
| 1126 | av_free(s); | 1131 | |
| 1132 | avio_context_free(&s); | ||
| 1133 | |||
| 1127 | return ffurl_close(h); | 1134 | return ffurl_close(h); |
| 1128 | } | 1135 | } |
| 1129 | 1136 | ||
| @@ -1356,7 +1363,9 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) · 226 unmodified lines | |||
| 1356 | *pbuffer = d->buffer; | 1363 | *pbuffer = d->buffer; |
| 1357 | size = d->size; | 1364 | size = d->size; |
| 1358 | av_free(d); | 1365 | av_free(d); |
| 1359 | av_free(s); | 1366 | |
| 1367 | avio_context_free(&s); | ||
| 1368 | |||
| 1360 | return size - padding; | 1369 | return size - padding; |
| 1361 | } | 1370 | } |
| 1362 | 1371 | ||
| @@ -1399,6 +1408,8 @@ int ffio_close_null_buf(AVIOContext *s) · 36 unmodified lines | |||
| 1399 | 1408 | ||
| 1400 | size = d->size; | 1409 | size = d->size; |
| 1401 | av_free(d); | 1410 | av_free(d); |
| 1402 | av_free(s); | 1411 | |
| 1412 | avio_context_free(&s); | ||
| 1413 | |||
| 1403 | return size; | 1414 | return size; |
| 1404 | } | 1415 | } |
| @@ -32,7 +32,7 @@ · 31 unmodified lines | |||
| 32 | // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) | 32 | // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) |
| 33 | // Also please add any ticket numbers that you believe might be affected here | 33 | // Also please add any ticket numbers that you believe might be affected here |
| 34 | #define LIBAVFORMAT_VERSION_MAJOR 57 | 34 | #define LIBAVFORMAT_VERSION_MAJOR 57 |
| 35 | #define LIBAVFORMAT_VERSION_MINOR 79 | 35 | #define LIBAVFORMAT_VERSION_MINOR 80 |
| 36 | #define LIBAVFORMAT_VERSION_MICRO 100 | 36 | #define LIBAVFORMAT_VERSION_MICRO 100 |
| 37 | 37 | ||
| 38 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ | 38 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |