[Ffmpeg-cvslog] r7561 - trunk/libavcodec/imgresample.c

Panagiotis Issaris takis.issaris
Thu Jan 18 13:52:09 CET 2007


Hi,

On Wed, 2007-01-17 at 23:13 +0000, M?ns Rullg?rd wrote:
> Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:
> 
> > Hello,
> > On Wed, Jan 17, 2007 at 11:26:14AM +0100, takis wrote:
> >> Author: takis
> >> Date: Wed Jan 17 11:26:13 2007
> >> New Revision: 7561
> >> 
> >> Modified:
> >>    trunk/libavcodec/imgresample.c
> >> 
> >> Log:
> >> fix segfault with http://sam.zoy.org/zzuf/lol-ffplay.ogm and
> >> http://sam.zoy.org/zzuf/lol-ffplay.ogg
> >> 
> >> 
> >> Modified: trunk/libavcodec/imgresample.c
> >> ==============================================================================
> >> --- trunk/libavcodec/imgresample.c	(original)
> >> +++ trunk/libavcodec/imgresample.c	Wed Jan 17 11:26:13 2007
> >> @@ -672,6 +672,8 @@
> >>  
> >>  void sws_freeContext(struct SwsContext *ctx)
> >>  {
> >> +    if (!ctx)
> >> +        return;
> >
> > I have a somewhat bad feeling about this, it seems probable to me that
> > this just masks a real bug/problem/stupid code...
> 
> That's exactly my opinion too on checks for conditions that should
> never happen, especially when the action is to silently ignore the bad
> condition.  If something has gone wrong it's better to crash with a
> nice hard core dump as soon as possible rather than have random memory
> corruption result mysterious things happening much later.
I agree... mostly. Although I think it also depends on programming style. In some cases
an assert might be better, but for this specific case involving a free of a previously
allocated struct, I think it is quiet common to have a check for NULL before freeing
it.

With friendly regards,
Takis
-- 
vCard: http://www.issaris.org/pi.vcf
Public key: http://www.issaris.org/pi.key





More information about the ffmpeg-cvslog mailing list