Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: base/gfx/jpeg_codec.cc

Issue 113433: Fix memory leak in corrupt JPEG decoding. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/valgrind/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/gfx/jpeg_codec.cc
===================================================================
--- base/gfx/jpeg_codec.cc (revision 16158)
+++ base/gfx/jpeg_codec.cc (working copy)
@@ -184,6 +184,7 @@
int quality, std::vector<unsigned char>* output) {
jpeg_compress_struct cinfo;
CompressDestroyer destroyer;
+ destroyer.SetManagedObject(&cinfo);
output->clear();
// We set up the normal JPEG error routines, then override error_exit.
@@ -204,7 +205,6 @@
// The destroyer will destroy() cinfo on exit.
jpeg_create_compress(&cinfo);
- destroyer.SetManagedObject(&cinfo);
cinfo.image_width = w;
cinfo.image_height = h;
@@ -395,6 +395,7 @@
int* w, int* h) {
jpeg_decompress_struct cinfo;
DecompressDestroyer destroyer;
+ destroyer.SetManagedObject(&cinfo);
output->clear();
// We set up the normal JPEG error routines, then override error_exit.
@@ -414,7 +415,6 @@
// The destroyer will destroy() cinfo on exit. We don't want to set the
// destroyer's object until cinfo is initialized.
jpeg_create_decompress(&cinfo);
- destroyer.SetManagedObject(&cinfo);
// set up the source manager
jpeg_source_mgr srcmgr;
« no previous file with comments | « no previous file | tools/valgrind/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698