Andreas Rheinhardt (12020-08-23): > > No. If *f is freshly allocated, it has no owner yet and unref_fn(f) will > > free it and set *f to NULL; av_freep(f) is then a no-op, so I removed > > it. Keeping it would also be against the philosphy of this API (that it > > cleans up after itself in case of error). > > Actually, no has no option but to remove said code: > "The value of a pointer becomes indeterminate when the object it points > to reaches the end of its lifetime." (C99, 6.2.4.2) > > If *f doesn't have any owners, it has already been freed in unref_fn() > and oldf becomes a dangling pointer, so that using it in a check is > undefined behaviour. (Storing the information whether this is a freshly > allocated list in a different way (e.g. an int) would of course work, > but there is no point in doing so.)
Right, thanks for explaining. -- Nicolas George
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".