Revision 12ad6671 libavformat/aiffdec.c

View differences:

libavformat/aiffdec.c
66 66
/* Metadata string read */
67 67
static void get_meta(AVFormatContext *s, const char *key, int size)
68 68
{
69
    uint8_t str[1024];
70
    int res = get_buffer(s->pb, str, FFMIN(sizeof(str)-1, size));
69
    uint8_t *str = av_malloc(size+1);
70
    int res;
71

  
72
    if (!str) {
73
        url_fskip(s->pb, size);
74
        return;
75
    }
76

  
77
    res = get_buffer(s->pb, str, size);
71 78
    if (res < 0)
72 79
        return;
73 80

  
74 81
    str[res] = 0;
75
    if (size & 1)
76
        size++;
77
    size -= res;
78
    if (size)
79
        url_fskip(s->pb, size);
80

  
81
    av_metadata_set(&s->metadata, key, str);
82
    av_metadata_set2(&s->metadata, key, str, AV_METADATA_DONT_STRDUP_VAL);
82 83
}
83 84

  
84 85
/* Returns the number of sound data frames or negative on error */

Also available in: Unified diff