[Ffmpeg-devel] [PATCH] Redundant memset

Panagiotis Issaris takis.issaris
Fri Sep 8 10:11:22 CEST 2006


Hi,

The attached patch removes a redundant memset from libavformat. The memory is
cleared with memset although it had been previously allocated with av_mallocz
and thus was already cleared. The function avformat_get_context_defaults()
is only used from av_alloc_format_context().

 utils.c |    1 -
 1 file changed, 1 deletion(-)

One problem with the first patch is that the semantic of avformat_get_context_defaults()
is possibly altered. Namely, if someone wants to set a beforehand allocated AVFormatContext
to the default values and memsetting the struct is considered as being default. So, the
second patch removes the redundancy in a different way, by changing the av_mallocz() to
av_malloc() and leaving the memset() untouched.

 utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

With friendly regards,
Takis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pi-20060908T100050-ffmpeg-redundant_memset.diff
Type: text/x-diff
Size: 466 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060908/3392ae83/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pi-20060908T100553-ffmpeg-redundant_memset_alt.diff
Type: text/x-diff
Size: 479 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060908/3392ae83/attachment-0001.diff>



More information about the ffmpeg-devel mailing list