void *grow_array(void *array, int elem_size, int *size, int new_size)

{

    if (new_size >= INT_MAX / elem_size) {

        av_log(NULL, AV_LOG_ERROR, "Array too big.\n");

        exit(1);

    }

    if (*size < new_size) {

        uint8_t *tmp = av_realloc(array, new_size*elem_size);

        if (!tmp) {

            av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");

            exit(1);

        }

        memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

        *size = new_size;

        return tmp;

    }

    return array;

}

void *grow_array(void *array, int elem_size, int *size, int new_size)

{

    if (new_size >= INT_MAX / elem_size) {

        av_log(NULL, AV_LOG_ERROR, "Array too big.\n");

        exit(1);

    }

    if (*size < new_size) {

        uint8_t *tmp = av_realloc(array, new_size*elem_size);

        if (!tmp) {

            av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");

            exit(1);

        }

        memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

        *size = new_size;

        return tmp;

    }

    return array;

}

        exit(1);             exit(1);         exit(1);         exit(1);             exit(1);             exit(1);             exit(1);             exit(1);             exit(1);         exit(1);         exit(1);             exit(1);         exit(1);         exit(1);         exit(1);         exit(1);         exit(1);         exit(1);         exit(1);         exit(1);         exit(1);         exit(1);         exit(1);         exit(1);             exit(1);
void *FUNC_0(void *VAR_0, int VAR_1, int *VAR_2, int VAR_3)

{

    if (VAR_3 >= INT_MAX / VAR_1) {

        av_log(NULL, AV_LOG_ERROR, "Array too big.\n");

        exit(1);

    }

    if (*VAR_2 < VAR_3) {

        uint8_t *tmp = av_realloc(VAR_0, VAR_3*VAR_1);

        if (!tmp) {

            av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");

            exit(1);

        }

        memset(tmp + *VAR_2*VAR_1, 0, (VAR_3-*VAR_2) * VAR_1);

        *VAR_2 = VAR_3;

        return tmp;

    }

    return VAR_0;

}

void *FUNC_0(void *VAR_0, int VAR_1, int *VAR_2, int VAR_3)
{ if (VAR_3 >= INT_MAX / VAR_1) { av_log(NULL, AV_LOG_ERROR, "Array too big.\n"); exit(1); } if (*VAR_2 < VAR_3) { uint8_t *tmp = av_realloc(VAR_0, VAR_3*VAR_1); if (!tmp) { av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n"); exit(1); } memset(tmp + *VAR_2*VAR_1, 0, (VAR_3-*VAR_2) * VAR_1); *VAR_2 = VAR_3; return tmp; } return VAR_0; }