[FFmpeg-devel] [PATCH v2] avformat/dashdec: Don't allocate and leak strings that are never used

Steven Liu lq at chinaffmpeg.org
Sun Mar 29 02:45:43 EET 2020



> 2020年3月29日 上午8:32,Andreas Rheinhardt <andreas.rheinhardt at gmail.com> 写道:
> 
> Since commit e134c203 strdups of several elements of a manifest are kept
> in the DASHContext; but said commit completely forgot to free these
> strings again (with xmlFree()). Given that these strings are never used
> at all, this commit closes this leak by reverting said commit.
> 
> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
> The only change in comparison to [1] is that the commit message now
> contains the typical "git revert"-line, including the full hash of the
> commit to be reverted.
> 
> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/258389.html
> 
> libavformat/dashdec.c | 27 ---------------------------
> 1 file changed, 27 deletions(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 5bbe5d3985..271202b0a5 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -122,19 +122,6 @@ struct representation {
> typedef struct DASHContext {
>     const AVClass *class;
>     char *base_url;
> -    char *adaptionset_contenttype_val;
> -    char *adaptionset_par_val;
> -    char *adaptionset_lang_val;
> -    char *adaptionset_minbw_val;
> -    char *adaptionset_maxbw_val;
> -    char *adaptionset_minwidth_val;
> -    char *adaptionset_maxwidth_val;
> -    char *adaptionset_minheight_val;
> -    char *adaptionset_maxheight_val;
> -    char *adaptionset_minframerate_val;
> -    char *adaptionset_maxframerate_val;
> -    char *adaptionset_segmentalignment_val;
> -    char *adaptionset_bitstreamswitching_val;
> 
>     int n_videos;
>     struct representation **videos;
> @@ -1124,26 +1111,12 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>                                         xmlNodePtr period_segmentlist_node)
> {
>     int ret = 0;
> -    DASHContext *c = s->priv_data;
>     xmlNodePtr fragment_template_node = NULL;
>     xmlNodePtr content_component_node = NULL;
>     xmlNodePtr adaptionset_baseurl_node = NULL;
>     xmlNodePtr adaptionset_segmentlist_node = NULL;
>     xmlNodePtr adaptionset_supplementalproperty_node = NULL;
>     xmlNodePtr node = NULL;
> -    c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, "contentType");
> -    c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
> -    c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
> -    c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, "minBandwidth");
> -    c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, "maxBandwidth");
> -    c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, "minWidth");
> -    c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, "maxWidth");
> -    c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, "minHeight");
> -    c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, "maxHeight");
> -    c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, "minFrameRate");
> -    c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, "maxFrameRate");
> -    c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, "segmentAlignment");
> -    c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, "bitstreamSwitching");
> 
>     node = xmlFirstElementChild(adaptionset_node);
>     while (node) {
> -- 
> 2.20.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

Applied


Thanks

Steven Liu



More information about the ffmpeg-devel mailing list