Comment 0 for bug 768379

Revision history for this message
rexpie@gmail.com (rexpie) wrote :

pbzip2 ver 1.1.3:
pbzip2.cpp:
In the producer(int hInfile, int blockSize, queue *fifo) function, there is a piece of code: (line 2482)

outBuff * queueElement = new(std::nothrow) outBuff(FileData, inSize, NumBlocks, 0);
// make sure memory was allocated properly
if (queueElement == NULL)
                {
                        close(hInfile);
                        handle_error(EF_EXIT, -1, "pbzip2: *ERROR: Could not allocate memory (queueElement)! Aborting...\n");
                        return -1;
                }

However inprobable, but when the allocation do fail, the fifo->mut mutex is not unlocked when the function returns with an error. This is an analysis finding when we are doing research on finding unmatched lock/unlock statements. We are very grateful for your source code which has been very helpful for our research. Thank you.