avformat: Use av_reallocp() where suitable

Signed-off-by: Diego Biurrun <diego@biurrun.de>
This commit is contained in:
Alexandra Khirnova
2013-09-18 18:12:36 +02:00
committed by Diego Biurrun
parent 0f310a6f33
commit 5626f994f2
18 changed files with 92 additions and 107 deletions

View File

@ -85,14 +85,12 @@ static int rtmp_http_send_cmd(URLContext *h, const char *cmd)
static int rtmp_http_write(URLContext *h, const uint8_t *buf, int size)
{
RTMP_HTTPContext *rt = h->priv_data;
void *ptr;
if (rt->out_size + size > rt->out_capacity) {
int err;
rt->out_capacity = (rt->out_size + size) * 2;
ptr = av_realloc(rt->out_data, rt->out_capacity);
if (!ptr)
return AVERROR(ENOMEM);
rt->out_data = ptr;
if ((err = av_reallocp(&rt->out_data, rt->out_capacity)) < 0)
return err;
}
memcpy(rt->out_data + rt->out_size, buf, size);