diff mbox

[FFmpeg-devel,v23,2/2] avformat/dashdec: free resource allocated by xml

Message ID 20170901102635.21851-1-lq@chinaffmpeg.org
State Accepted
Commit ab96e2ca81d7dd7d02c2b2176fc3dac85d9e8cb9
Headers show

Commit Message

Steven Liu Sept. 1, 2017, 10:26 a.m. UTC
modify from av_free to xmlFree

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/dashdec.c | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

Comments

Steven Liu Sept. 4, 2017, 2:58 p.m. UTC | #1
2017-09-01 18:26 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:
> modify from av_free to xmlFree
>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/dashdec.c | 44 ++++++++++++++++++++++----------------------
>  1 file changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 9a3a199d4e..f63f1fffbd 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -440,7 +440,7 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes,
>                  memset(tmp_str_2, 0, sizeof(tmp_str_2));
>                  ff_make_absolute_url(tmp_str_2, MAX_URL_SIZE, tmp_str, text);
>                  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")) {
>                      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) {
>              rep->init_section = av_mallocz(sizeof(struct fragment));
>              if (!rep->init_section) {
> -                av_free(initialization_val);
> +                xmlFree(initialization_val);
>                  return AVERROR(ENOMEM);
>              }
>              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);
>              if (!rep->init_section->url) {
>                  av_free(rep->init_section);
> -                av_free(initialization_val);
> +                xmlFree(initialization_val);
>                  return AVERROR(ENOMEM);
>              }
>              rep->init_section->size = -1;
> -            av_free(initialization_val);
> +            xmlFree(initialization_val);
>          }
>      } else if (!av_strcasecmp(fragmenturl_node->name, (const char *)"SegmentURL")) {
>          media_val = xmlGetProp(fragmenturl_node, "media");
>          if (media_val) {
>              struct fragment *seg = av_mallocz(sizeof(struct fragment));
>              if (!seg) {
> -                av_free(media_val);
> +                xmlFree(media_val);
>                  return AVERROR(ENOMEM);
>              }
>              seg->url = get_content_url(baseurl_nodes, 4,
> @@ -565,12 +565,12 @@ static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
>                                         media_val);
>              if (!seg->url) {
>                  av_free(seg);
> -                av_free(media_val);
> +                xmlFree(media_val);
>                  return AVERROR(ENOMEM);
>              }
>              seg->size = -1;
>              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);
>              }
>              attr = attr->next;
> -            av_free(val);
> +            xmlFree(val);
>          }
>          dynarray_add(&rep->timelines, &rep->n_timelines, tml);
>      }
> @@ -699,29 +699,29 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
>                      goto end;
>                  }
>                  rep->init_section->size = -1;
> -                av_free(initialization_val);
> +                xmlFree(initialization_val);
>              }
>
>              if (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) {
>                  rep->presentation_timeoffset = (int64_t) strtoll(presentation_timeoffset_val, NULL, 10);
> -                av_free(presentation_timeoffset_val);
> +                xmlFree(presentation_timeoffset_val);
>              }
>              if (duration_val) {
>                  rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10);
> -                av_free(duration_val);
> +                xmlFree(duration_val);
>              }
>              if (timescale_val) {
>                  rep->fragment_timescale = (int64_t) strtoll(timescale_val, NULL, 10);
> -                av_free(timescale_val);
> +                xmlFree(timescale_val);
>              }
>              if (startnumber_val) {
>                  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");
> @@ -760,11 +760,11 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
>              timescale_val = xmlGetProp(representation_segmentlist_node, "timescale");
>              if (duration_val) {
>                  rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10);
> -                av_free(duration_val);
> +                xmlFree(duration_val);
>              }
>              if (timescale_val) {
>                  rep->fragment_timescale = (int64_t) strtoll(timescale_val, NULL, 10);
> -                av_free(timescale_val);
> +                xmlFree(timescale_val);
>              }
>              fragmenturl_node = xmlFirstElementChild(representation_segmentlist_node);
>              while (fragmenturl_node) {
> @@ -816,9 +816,9 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
>
>  end:
>      if (rep_id_val)
> -        av_free(rep_id_val);
> +        xmlFree(rep_id_val);
>      if (rep_bandwidth_val)
> -        av_free(rep_bandwidth_val);
> +        xmlFree(rep_bandwidth_val);
>
>      return ret;
>  }
> @@ -941,7 +941,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
>          }
>          if (!av_strcasecmp(val, (const char *)"dynamic"))
>              c->is_live = 1;
> -        av_free(val);
> +        xmlFree(val);
>
>          attr = node->properties;
>          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);
>              }
>              attr = attr->next;
> -            av_free(val);
> +            xmlFree(val);
>          }
>
>          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);
>                      }
>                      attr = attr->next;
> -                    av_free(val);
> +                    xmlFree(val);
>                  }
>                  if ((perdiod_duration_sec) >= (c->period_duration)) {
>                      period_node = node;
> --
> 2.11.0 (Apple Git-81)
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

ping ?
wm4 Sept. 4, 2017, 3:36 p.m. UTC | #2
On Mon, 4 Sep 2017 22:58:27 +0800
Steven Liu <lingjiujianke@gmail.com> wrote:

> 2017-09-01 18:26 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:
> > modify from av_free to xmlFree
> >
> > Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> > ---
> >  libavformat/dashdec.c | 44 ++++++++++++++++++++++----------------------
> >  1 file changed, 22 insertions(+), 22 deletions(-)
> >


> ping ?

That change seems good?
Steven Liu Sept. 4, 2017, 3:55 p.m. UTC | #3
2017-09-04 23:36 GMT+08:00 wm4 <nfxjfg@googlemail.com>:
> On Mon, 4 Sep 2017 22:58:27 +0800
> Steven Liu <lingjiujianke@gmail.com> wrote:
>
>> 2017-09-01 18:26 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:
>> > modify from av_free to xmlFree
>> >
>> > Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>> > ---
>> >  libavformat/dashdec.c | 44 ++++++++++++++++++++++----------------------
>> >  1 file changed, 22 insertions(+), 22 deletions(-)
>> >
>
>
>> ping ?
>
> That change seems good?
LGTM, the change is modify from xmlFree to av_free, now, revert it :)
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Steven Liu Sept. 9, 2017, 12:37 a.m. UTC | #4
2017-09-04 23:55 GMT+08:00 Steven Liu <lingjiujianke@gmail.com>:
> 2017-09-04 23:36 GMT+08:00 wm4 <nfxjfg@googlemail.com>:
>> On Mon, 4 Sep 2017 22:58:27 +0800
>> Steven Liu <lingjiujianke@gmail.com> wrote:
>>
>>> 2017-09-01 18:26 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:
>>> > modify from av_free to xmlFree
>>> >
>>> > Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>>> > ---
>>> >  libavformat/dashdec.c | 44 ++++++++++++++++++++++----------------------
>>> >  1 file changed, 22 insertions(+), 22 deletions(-)
>>> >
>>
>>
>>> ping ?
>>
>> That change seems good?
> LGTM, the change is modify from xmlFree to av_free, now, revert it :)

pushed
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Thanks
wm4 Sept. 19, 2017, 7:48 p.m. UTC | #5
On Sat, 9 Sep 2017 08:37:17 +0800
Steven Liu <lingjiujianke@gmail.com> wrote:

> 2017-09-04 23:55 GMT+08:00 Steven Liu <lingjiujianke@gmail.com>:
> > 2017-09-04 23:36 GMT+08:00 wm4 <nfxjfg@googlemail.com>:  
> >> On Mon, 4 Sep 2017 22:58:27 +0800
> >> Steven Liu <lingjiujianke@gmail.com> wrote:
> >>  
> >>> 2017-09-01 18:26 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:  
> >>> > modify from av_free to xmlFree
> >>> >
> >>> > Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> >>> > ---
> >>> >  libavformat/dashdec.c | 44 ++++++++++++++++++++++----------------------
> >>> >  1 file changed, 22 insertions(+), 22 deletions(-)
> >>> >  
> >>
> >>  
> >>> ping ?  
> >>
> >> That change seems good?  
> > LGTM, the change is modify from xmlFree to av_free, now, revert it :)  
> 
> pushed
> >> _______________________________________________
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel  
> 
> 
> Thanks

It wasn't really an OK for pushing, but whatever.
diff mbox

Patch

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 9a3a199d4e..f63f1fffbd 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -440,7 +440,7 @@  static char *get_content_url(xmlNodePtr *baseurl_nodes,
                 memset(tmp_str_2, 0, sizeof(tmp_str_2));
                 ff_make_absolute_url(tmp_str_2, MAX_URL_SIZE, tmp_str, text);
                 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")) {
                     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) {
             rep->init_section = av_mallocz(sizeof(struct fragment));
             if (!rep->init_section) {
-                av_free(initialization_val);
+                xmlFree(initialization_val);
                 return AVERROR(ENOMEM);
             }
             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);
             if (!rep->init_section->url) {
                 av_free(rep->init_section);
-                av_free(initialization_val);
+                xmlFree(initialization_val);
                 return AVERROR(ENOMEM);
             }
             rep->init_section->size = -1;
-            av_free(initialization_val);
+            xmlFree(initialization_val);
         }
     } else if (!av_strcasecmp(fragmenturl_node->name, (const char *)"SegmentURL")) {
         media_val = xmlGetProp(fragmenturl_node, "media");
         if (media_val) {
             struct fragment *seg = av_mallocz(sizeof(struct fragment));
             if (!seg) {
-                av_free(media_val);
+                xmlFree(media_val);
                 return AVERROR(ENOMEM);
             }
             seg->url = get_content_url(baseurl_nodes, 4,
@@ -565,12 +565,12 @@  static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
                                        media_val);
             if (!seg->url) {
                 av_free(seg);
-                av_free(media_val);
+                xmlFree(media_val);
                 return AVERROR(ENOMEM);
             }
             seg->size = -1;
             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);
             }
             attr = attr->next;
-            av_free(val);
+            xmlFree(val);
         }
         dynarray_add(&rep->timelines, &rep->n_timelines, tml);
     }
@@ -699,29 +699,29 @@  static int parse_manifest_representation(AVFormatContext *s, const char *url,
                     goto end;
                 }
                 rep->init_section->size = -1;
-                av_free(initialization_val);
+                xmlFree(initialization_val);
             }
 
             if (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) {
                 rep->presentation_timeoffset = (int64_t) strtoll(presentation_timeoffset_val, NULL, 10);
-                av_free(presentation_timeoffset_val);
+                xmlFree(presentation_timeoffset_val);
             }
             if (duration_val) {
                 rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10);
-                av_free(duration_val);
+                xmlFree(duration_val);
             }
             if (timescale_val) {
                 rep->fragment_timescale = (int64_t) strtoll(timescale_val, NULL, 10);
-                av_free(timescale_val);
+                xmlFree(timescale_val);
             }
             if (startnumber_val) {
                 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");
@@ -760,11 +760,11 @@  static int parse_manifest_representation(AVFormatContext *s, const char *url,
             timescale_val = xmlGetProp(representation_segmentlist_node, "timescale");
             if (duration_val) {
                 rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10);
-                av_free(duration_val);
+                xmlFree(duration_val);
             }
             if (timescale_val) {
                 rep->fragment_timescale = (int64_t) strtoll(timescale_val, NULL, 10);
-                av_free(timescale_val);
+                xmlFree(timescale_val);
             }
             fragmenturl_node = xmlFirstElementChild(representation_segmentlist_node);
             while (fragmenturl_node) {
@@ -816,9 +816,9 @@  static int parse_manifest_representation(AVFormatContext *s, const char *url,
 
 end:
     if (rep_id_val)
-        av_free(rep_id_val);
+        xmlFree(rep_id_val);
     if (rep_bandwidth_val)
-        av_free(rep_bandwidth_val);
+        xmlFree(rep_bandwidth_val);
 
     return ret;
 }
@@ -941,7 +941,7 @@  static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
         }
         if (!av_strcasecmp(val, (const char *)"dynamic"))
             c->is_live = 1;
-        av_free(val);
+        xmlFree(val);
 
         attr = node->properties;
         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);
             }
             attr = attr->next;
-            av_free(val);
+            xmlFree(val);
         }
 
         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);
                     }
                     attr = attr->next;
-                    av_free(val);
+                    xmlFree(val);
                 }
                 if ((perdiod_duration_sec) >= (c->period_duration)) {
                     period_node = node;