Only destroy huffman if build succeeded.

The earlier code assumed that if jpeg_create_huffman_index
succeeded but jpeg_build_huffman_index failed that the
index would still need to be destroyed. This is not the
case. Only call jpeg_destroy_huffman_index if both
succeeded.

BUG=http://b.corp.google.com/issue?id=10263847

Review URL: https://codereview.chromium.org/22859042

git-svn-id: http://skia.googlecode.com/svn/trunk@10954 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
scroggo@google.com 2013-08-27 20:42:22 +00:00
parent 319e01f1aa
commit 57a529877e

View File

@ -143,9 +143,9 @@ public:
SkASSERT(fReadHeaderSucceeded);
SkASSERT(!fHuffmanCreated);
jpeg_create_huffman_index(&fCInfo, &fHuffmanIndex);
fHuffmanCreated = true;
SkASSERT(1 == fCInfo.scale_num && 1 == fCInfo.scale_denom);
return jpeg_build_huffman_index(&fCInfo, &fHuffmanIndex);
fHuffmanCreated = jpeg_build_huffman_index(&fCInfo, &fHuffmanIndex);
return fHuffmanCreated;
}
/**