Message ID | 1577966105-4642-5-git-send-email-mypopydev@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,V2,1/5] lavc/bsf: fix memory leak after av_dict_parse_string fail | expand |
Context | Check | Description |
---|---|---|
andriy/ffmpeg-patchwork | success | Make fate finished |
On Thu, Jan 02, 2020 at 07:55:05PM +0800, Jun Zhao wrote: > From: Jun Zhao <barryjzhao@tencent.com> > > In case of failure, all the successfully set entries are stored in > *pm. We need to manually free the created dictionary to avoid > memory leak. > > Signed-off-by: Jun Zhao <barryjzhao@tencent.com> > --- > tools/aviocat.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/tools/aviocat.c b/tools/aviocat.c > index 816ab70..0fdf39b 100644 > --- a/tools/aviocat.c > +++ b/tools/aviocat.c > @@ -53,6 +53,7 @@ int main(int argc, char **argv) > i++; > } else if (!strcmp(argv[i], "-oi") && i + 1 < argc) { > if (av_dict_parse_string(&in_opts, argv[i + 1], "=", ":", 0) < 0) { > + av_dict_free(&in_opts); > fprintf(stderr, "Cannot parse option string %s\n", > argv[i + 1]); > return usage(argv[0], 1); > @@ -60,6 +61,7 @@ int main(int argc, char **argv) > i++; > } else if (!strcmp(argv[i], "-oo") && i + 1 < argc) { > if (av_dict_parse_string(&out_opts, argv[i + 1], "=", ":", 0) < 0) { > + av_dict_free(&out_opts); > fprintf(stderr, "Cannot parse option string %s\n", > argv[i + 1]); > return usage(argv[0], 1); I think these are not sufficient to fix the memleaks thanks [...]
On Fri, Jan 3, 2020 at 7:39 AM Michael Niedermayer <michael@niedermayer.cc> wrote: > > On Thu, Jan 02, 2020 at 07:55:05PM +0800, Jun Zhao wrote: > > From: Jun Zhao <barryjzhao@tencent.com> > > > > In case of failure, all the successfully set entries are stored in > > *pm. We need to manually free the created dictionary to avoid > > memory leak. > > > > Signed-off-by: Jun Zhao <barryjzhao@tencent.com> > > --- > > tools/aviocat.c | 2 ++ > > 1 files changed, 2 insertions(+), 0 deletions(-) > > > > diff --git a/tools/aviocat.c b/tools/aviocat.c > > index 816ab70..0fdf39b 100644 > > --- a/tools/aviocat.c > > +++ b/tools/aviocat.c > > @@ -53,6 +53,7 @@ int main(int argc, char **argv) > > i++; > > } else if (!strcmp(argv[i], "-oi") && i + 1 < argc) { > > if (av_dict_parse_string(&in_opts, argv[i + 1], "=", ":", 0) < 0) { > > + av_dict_free(&in_opts); > > fprintf(stderr, "Cannot parse option string %s\n", > > argv[i + 1]); > > return usage(argv[0], 1); > > @@ -60,6 +61,7 @@ int main(int argc, char **argv) > > i++; > > } else if (!strcmp(argv[i], "-oo") && i + 1 < argc) { > > if (av_dict_parse_string(&out_opts, argv[i + 1], "=", ":", 0) < 0) { > > + av_dict_free(&out_opts); > > fprintf(stderr, "Cannot parse option string %s\n", > > argv[i + 1]); > > return usage(argv[0], 1); > > I think these are not sufficient to fix the memleaks > > thanks > Will double-check this part, thx
diff --git a/tools/aviocat.c b/tools/aviocat.c index 816ab70..0fdf39b 100644 --- a/tools/aviocat.c +++ b/tools/aviocat.c @@ -53,6 +53,7 @@ int main(int argc, char **argv) i++; } else if (!strcmp(argv[i], "-oi") && i + 1 < argc) { if (av_dict_parse_string(&in_opts, argv[i + 1], "=", ":", 0) < 0) { + av_dict_free(&in_opts); fprintf(stderr, "Cannot parse option string %s\n", argv[i + 1]); return usage(argv[0], 1); @@ -60,6 +61,7 @@ int main(int argc, char **argv) i++; } else if (!strcmp(argv[i], "-oo") && i + 1 < argc) { if (av_dict_parse_string(&out_opts, argv[i + 1], "=", ":", 0) < 0) { + av_dict_free(&out_opts); fprintf(stderr, "Cannot parse option string %s\n", argv[i + 1]); return usage(argv[0], 1);