In put_main_header(), av_mallocz() allocates memory to local variable buffer, buffer leaks if av_mallocz() to *out failed. Add av_free(buffer) before return error code.
Unified · Split
| @@ -740,8 +740,10 @@ static int put_main_header(vorbis_enc_context *venc, uint8_t **out) · 739 unmodified lines | |||
| 740 | 740 | ||
| 741 | len = hlens[0] + hlens[1] + hlens[2]; | 741 | len = hlens[0] + hlens[1] + hlens[2]; |
| 742 | p = *out = av_mallocz(64 + len + len/255); | 742 | p = *out = av_mallocz(64 + len + len/255); |
| 743 | if (!p) | 743 | if (!p) { |
| 744 | av_freep(&buffer); | ||
| 744 | return AVERROR(ENOMEM); | 745 | return AVERROR(ENOMEM); |
| 746 | } | ||
| 745 | 747 | ||
| 746 | *p++ = 2; | 748 | *p++ = 2; |
| 747 | p += av_xiphlacing(p, hlens[0]); | 749 | p += av_xiphlacing(p, hlens[0]); |