summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorQin Zhao <zhaoqin@google.com>2015-11-25 10:45:09 -0500
committerQin Zhao <zhaoqin@google.com>2015-11-25 10:45:09 -0500
commit6c2d736011c09266015d3e2a0b9c08aeba1bbf31 (patch)
treef617efeb9d6af22a47dce41e01999592c5642ac1 /core
parent38ad68cdea4fe106293d55ae1b96bab2791f96c7 (diff)
downloadpdfium-6c2d736011c09266015d3e2a0b9c08aeba1bbf31.tar.xz
Fix two memory leaks from pdfium_unittests
- remove redundant alloc in fx_codec_jpx_unittest.cpp - free memory allocated by HexDecode calls in fpdf_parser_decode_unittest.cpp BUG=PDFium:239 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1467183006 .
Diffstat (limited to 'core')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp4
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpx_unittest.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp
index 95d7c84ace..3318bcdfe7 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp
@@ -14,6 +14,7 @@ TEST(fpdf_parser_decode, HexDecode) {
EXPECT_EQ(0, HexDecode(src, 0, dest, dest_size));
EXPECT_EQ(0, dest_size);
EXPECT_EQ('\0', dest[0]);
+ FX_Free(dest);
}
{
@@ -25,6 +26,7 @@ TEST(fpdf_parser_decode, HexDecode) {
EXPECT_EQ(2, dest_size);
EXPECT_EQ(18, dest[0]);
EXPECT_EQ(172, dest[1]);
+ FX_Free(dest);
}
{
@@ -36,6 +38,7 @@ TEST(fpdf_parser_decode, HexDecode) {
EXPECT_EQ(2, dest_size);
EXPECT_EQ(18, dest[0]);
EXPECT_EQ(160, dest[1]);
+ FX_Free(dest);
}
{
@@ -47,5 +50,6 @@ TEST(fpdf_parser_decode, HexDecode) {
EXPECT_EQ(2, dest_size);
EXPECT_EQ(18, dest[0]);
EXPECT_EQ(172, dest[1]);
+ FX_Free(dest);
}
}
diff --git a/core/src/fxcodec/codec/fx_codec_jpx_unittest.cpp b/core/src/fxcodec/codec/fx_codec_jpx_unittest.cpp
index fe552d2ed1..4139fbde3b 100644
--- a/core/src/fxcodec/codec/fx_codec_jpx_unittest.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpx_unittest.cpp
@@ -474,8 +474,6 @@ TEST(fxcodec, YUV420ToRGB) {
u.h = 16;
u.prec = 8;
u.bpp = 8;
- u.data = FX_Alloc(OPJ_INT32, u.w * u.h);
- memset(u.data, 0, u.w * u.h * sizeof(OPJ_INT32));
opj_image_comp_t v;
memset(&v, 0, sizeof(v));
v.dx = 1;
@@ -484,8 +482,6 @@ TEST(fxcodec, YUV420ToRGB) {
v.h = 16;
v.prec = 8;
v.bpp = 8;
- v.data = FX_Alloc(OPJ_INT32, v.w * v.h);
- memset(v.data, 0, v.w * v.h * sizeof(OPJ_INT32));
opj_image_comp_t y;
memset(&y, 0, sizeof(y));
y.dx = 1;