Menu

#258 Fix some pointer initialisations

1.3.0
closed-works-for-me
libFLAC (59)
1
2013-08-20
2007-03-09
No

Pointers should not be initialised by the function "calloc" if they are a member of a bigger data structure. Would you like to deal with an internal representation that is not all-bits-0?
http://c-faq.com/null/varieties.html

I recommend to assign a "0" to data elements like "buffer" in the functions "FLAC__bitreader_new" and "FLAC__bitwriter_new" separately.
http://flac.cvs.sourceforge.net/flac/flac/src/libFLAC/bitreader.c?revision=1.6&view=markup
http://flac.cvs.sourceforge.net/flac/flac/src/libFLAC/bitwriter.c?revision=1.8&view=markup

Are assignments for the data element "words" in the functions "FLAC__bitreader_init" and "FLAC__bitwriter_init" unnecassary in this context?

Discussion

  • Josh Coalson

    Josh Coalson - 2007-03-15
    • priority: 5 --> 1
    • assigned_to: nobody --> jcoalson
    • status: open --> open-accepted
     
  • Ralph Giles

    Ralph Giles - 2013-08-20

    This is a pretty common idiom these days, but I forwarded the issue to the mailing list for further discussion. Please follow up there.

     
  • Ralph Giles

    Ralph Giles - 2013-08-20
    • status: open-accepted --> closed-works-for-me
    • Group: --> 1.3.0
     

Log in to post a comment.

MongoDB Logo MongoDB