Message ID | 1588251554-3665-3-git-send-email-lance.lmwang@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [FFmpeg-devel,1/5] avcodec/v4l2_m2m_enc: reindent code | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
lance.lmwang@gmail.com: > From: Limin Wang <lance.lmwang@gmail.com> > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > --- > libavformat/mov.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 3d6fef685d..03c8801402 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -6827,7 +6827,7 @@ static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom) > ret = av_stream_add_side_data(st, AV_PKT_DATA_DOVI_CONF, > (uint8_t *)dovi, dovi_size); > if (ret < 0) { > - av_freep(dovi); > + av_freep(&dovi); > return ret; > } > > Nice catch. LGTM; but you could also just use av_free() given that the lifetime of the dovi pointer ends automatically when you exit the function. - Andreas
Quoting Andreas Rheinhardt (2020-04-30 15:10:59) > lance.lmwang@gmail.com: > > From: Limin Wang <lance.lmwang@gmail.com> > > > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > > --- > > libavformat/mov.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/mov.c b/libavformat/mov.c > > index 3d6fef685d..03c8801402 100644 > > --- a/libavformat/mov.c > > +++ b/libavformat/mov.c > > @@ -6827,7 +6827,7 @@ static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom) > > ret = av_stream_add_side_data(st, AV_PKT_DATA_DOVI_CONF, > > (uint8_t *)dovi, dovi_size); > > if (ret < 0) { > > - av_freep(dovi); > > + av_freep(&dovi); > > return ret; > > } > > > > > Nice catch. LGTM; but you could also just use av_free() given that the > lifetime of the dovi pointer ends automatically when you exit the function. FWIW I prefer to just use av_freep() always even when it is not strictly necessary, simply because it's never worse than av_free (overhead is negligible) so you don't waste any brainpower wondering which one to use.
diff --git a/libavformat/mov.c b/libavformat/mov.c index 3d6fef685d..03c8801402 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6827,7 +6827,7 @@ static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom) ret = av_stream_add_side_data(st, AV_PKT_DATA_DOVI_CONF, (uint8_t *)dovi, dovi_size); if (ret < 0) { - av_freep(dovi); + av_freep(&dovi); return ret; }