If ALT_BITSTREAM_ALLOC flag is set. under certain conditions the encoder may attempt to expand previously allocated bitstream buffer for a particular slice (umc_h264_core_enc_tmpl.cpp.h). The memory is released by making a "free" call, then re-allocated. There seems to be a problem with this though because as far as I understand, the pointer being freed may not be the one previously obtained by making an "alloc" call: H264CoreEncoder_Init function (umc_h264_gen_enc_tmpl.cpp.h) allocates a single large buffer and assigns pointers into this large buffer for each slice. Am I correct in believing that this code may cause heap corruption?
The encoder crash I was experiencing seemed to go away after I disabled ALT_BITSTREAM_ALLOC and allowed a bigger bitstream buffer, but, on the other hand, my attempt to keep the resizing code and add changes such that individual buffers are allocated for each slice didn't work well.