mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/dashdec: free resource allocated by xml
modify from av_free to xmlFree Suggested-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
parent
96d70694ae
commit
ab96e2ca81
|
@ -440,7 +440,7 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes,
|
||||||
memset(tmp_str_2, 0, sizeof(tmp_str_2));
|
memset(tmp_str_2, 0, sizeof(tmp_str_2));
|
||||||
ff_make_absolute_url(tmp_str_2, MAX_URL_SIZE, tmp_str, text);
|
ff_make_absolute_url(tmp_str_2, MAX_URL_SIZE, tmp_str, text);
|
||||||
av_strlcpy(tmp_str, tmp_str_2, sizeof(tmp_str));
|
av_strlcpy(tmp_str, tmp_str_2, sizeof(tmp_str));
|
||||||
av_free(text);
|
xmlFree(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ static enum AVMediaType get_content_type(xmlNodePtr node)
|
||||||
} else if (av_stristr((const char *)val, "audio")) {
|
} else if (av_stristr((const char *)val, "audio")) {
|
||||||
type = AVMEDIA_TYPE_AUDIO;
|
type = AVMEDIA_TYPE_AUDIO;
|
||||||
}
|
}
|
||||||
av_free(val);
|
xmlFree(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -536,7 +536,7 @@ static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
|
||||||
if (initialization_val) {
|
if (initialization_val) {
|
||||||
rep->init_section = av_mallocz(sizeof(struct fragment));
|
rep->init_section = av_mallocz(sizeof(struct fragment));
|
||||||
if (!rep->init_section) {
|
if (!rep->init_section) {
|
||||||
av_free(initialization_val);
|
xmlFree(initialization_val);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
rep->init_section->url = get_content_url(baseurl_nodes, 4,
|
rep->init_section->url = get_content_url(baseurl_nodes, 4,
|
||||||
|
@ -545,18 +545,18 @@ static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
|
||||||
initialization_val);
|
initialization_val);
|
||||||
if (!rep->init_section->url) {
|
if (!rep->init_section->url) {
|
||||||
av_free(rep->init_section);
|
av_free(rep->init_section);
|
||||||
av_free(initialization_val);
|
xmlFree(initialization_val);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
rep->init_section->size = -1;
|
rep->init_section->size = -1;
|
||||||
av_free(initialization_val);
|
xmlFree(initialization_val);
|
||||||
}
|
}
|
||||||
} else if (!av_strcasecmp(fragmenturl_node->name, (const char *)"SegmentURL")) {
|
} else if (!av_strcasecmp(fragmenturl_node->name, (const char *)"SegmentURL")) {
|
||||||
media_val = xmlGetProp(fragmenturl_node, "media");
|
media_val = xmlGetProp(fragmenturl_node, "media");
|
||||||
if (media_val) {
|
if (media_val) {
|
||||||
struct fragment *seg = av_mallocz(sizeof(struct fragment));
|
struct fragment *seg = av_mallocz(sizeof(struct fragment));
|
||||||
if (!seg) {
|
if (!seg) {
|
||||||
av_free(media_val);
|
xmlFree(media_val);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
seg->url = get_content_url(baseurl_nodes, 4,
|
seg->url = get_content_url(baseurl_nodes, 4,
|
||||||
|
@ -565,12 +565,12 @@ static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
|
||||||
media_val);
|
media_val);
|
||||||
if (!seg->url) {
|
if (!seg->url) {
|
||||||
av_free(seg);
|
av_free(seg);
|
||||||
av_free(media_val);
|
xmlFree(media_val);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
seg->size = -1;
|
seg->size = -1;
|
||||||
dynarray_add(&rep->fragments, &rep->n_fragments, seg);
|
dynarray_add(&rep->fragments, &rep->n_fragments, seg);
|
||||||
av_free(media_val);
|
xmlFree(media_val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ static int parse_manifest_segmenttimeline(AVFormatContext *s, struct representat
|
||||||
tml->duration = (int64_t)strtoll(val, NULL, 10);
|
tml->duration = (int64_t)strtoll(val, NULL, 10);
|
||||||
}
|
}
|
||||||
attr = attr->next;
|
attr = attr->next;
|
||||||
av_free(val);
|
xmlFree(val);
|
||||||
}
|
}
|
||||||
dynarray_add(&rep->timelines, &rep->n_timelines, tml);
|
dynarray_add(&rep->timelines, &rep->n_timelines, tml);
|
||||||
}
|
}
|
||||||
|
@ -699,29 +699,29 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
rep->init_section->size = -1;
|
rep->init_section->size = -1;
|
||||||
av_free(initialization_val);
|
xmlFree(initialization_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (media_val) {
|
if (media_val) {
|
||||||
rep->url_template = get_content_url(baseurl_nodes, 4, rep_id_val, rep_bandwidth_val, media_val);
|
rep->url_template = get_content_url(baseurl_nodes, 4, rep_id_val, rep_bandwidth_val, media_val);
|
||||||
av_free(media_val);
|
xmlFree(media_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (presentation_timeoffset_val) {
|
if (presentation_timeoffset_val) {
|
||||||
rep->presentation_timeoffset = (int64_t) strtoll(presentation_timeoffset_val, NULL, 10);
|
rep->presentation_timeoffset = (int64_t) strtoll(presentation_timeoffset_val, NULL, 10);
|
||||||
av_free(presentation_timeoffset_val);
|
xmlFree(presentation_timeoffset_val);
|
||||||
}
|
}
|
||||||
if (duration_val) {
|
if (duration_val) {
|
||||||
rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10);
|
rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10);
|
||||||
av_free(duration_val);
|
xmlFree(duration_val);
|
||||||
}
|
}
|
||||||
if (timescale_val) {
|
if (timescale_val) {
|
||||||
rep->fragment_timescale = (int64_t) strtoll(timescale_val, NULL, 10);
|
rep->fragment_timescale = (int64_t) strtoll(timescale_val, NULL, 10);
|
||||||
av_free(timescale_val);
|
xmlFree(timescale_val);
|
||||||
}
|
}
|
||||||
if (startnumber_val) {
|
if (startnumber_val) {
|
||||||
rep->first_seq_no = (int64_t) strtoll(startnumber_val, NULL, 10);
|
rep->first_seq_no = (int64_t) strtoll(startnumber_val, NULL, 10);
|
||||||
av_free(startnumber_val);
|
xmlFree(startnumber_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment_timeline_node = find_child_node_by_name(representation_segmenttemplate_node, "SegmentTimeline");
|
fragment_timeline_node = find_child_node_by_name(representation_segmenttemplate_node, "SegmentTimeline");
|
||||||
|
@ -760,11 +760,11 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
|
||||||
timescale_val = xmlGetProp(representation_segmentlist_node, "timescale");
|
timescale_val = xmlGetProp(representation_segmentlist_node, "timescale");
|
||||||
if (duration_val) {
|
if (duration_val) {
|
||||||
rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10);
|
rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10);
|
||||||
av_free(duration_val);
|
xmlFree(duration_val);
|
||||||
}
|
}
|
||||||
if (timescale_val) {
|
if (timescale_val) {
|
||||||
rep->fragment_timescale = (int64_t) strtoll(timescale_val, NULL, 10);
|
rep->fragment_timescale = (int64_t) strtoll(timescale_val, NULL, 10);
|
||||||
av_free(timescale_val);
|
xmlFree(timescale_val);
|
||||||
}
|
}
|
||||||
fragmenturl_node = xmlFirstElementChild(representation_segmentlist_node);
|
fragmenturl_node = xmlFirstElementChild(representation_segmentlist_node);
|
||||||
while (fragmenturl_node) {
|
while (fragmenturl_node) {
|
||||||
|
@ -816,9 +816,9 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (rep_id_val)
|
if (rep_id_val)
|
||||||
av_free(rep_id_val);
|
xmlFree(rep_id_val);
|
||||||
if (rep_bandwidth_val)
|
if (rep_bandwidth_val)
|
||||||
av_free(rep_bandwidth_val);
|
xmlFree(rep_bandwidth_val);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -941,7 +941,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
|
||||||
}
|
}
|
||||||
if (!av_strcasecmp(val, (const char *)"dynamic"))
|
if (!av_strcasecmp(val, (const char *)"dynamic"))
|
||||||
c->is_live = 1;
|
c->is_live = 1;
|
||||||
av_free(val);
|
xmlFree(val);
|
||||||
|
|
||||||
attr = node->properties;
|
attr = node->properties;
|
||||||
while (attr) {
|
while (attr) {
|
||||||
|
@ -963,7 +963,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
|
||||||
c->media_presentation_duration = get_duration_insec(s, (const char *)val);
|
c->media_presentation_duration = get_duration_insec(s, (const char *)val);
|
||||||
}
|
}
|
||||||
attr = attr->next;
|
attr = attr->next;
|
||||||
av_free(val);
|
xmlFree(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
mpd_baseurl_node = find_child_node_by_name(node, "BaseURL");
|
mpd_baseurl_node = find_child_node_by_name(node, "BaseURL");
|
||||||
|
@ -983,7 +983,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
|
||||||
perdiod_start_sec = get_duration_insec(s, (const char *)val);
|
perdiod_start_sec = get_duration_insec(s, (const char *)val);
|
||||||
}
|
}
|
||||||
attr = attr->next;
|
attr = attr->next;
|
||||||
av_free(val);
|
xmlFree(val);
|
||||||
}
|
}
|
||||||
if ((perdiod_duration_sec) >= (c->period_duration)) {
|
if ((perdiod_duration_sec) >= (c->period_duration)) {
|
||||||
period_node = node;
|
period_node = node;
|
||||||
|
|
Loading…
Reference in New Issue