SkPDF: ASAN fix: don't double ref new SkPDFBitmap objects
TBR=robertphillips@google.com,tomhudson@google.com,
Review URL: https://codereview.chromium.org/1381073005
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 8d53b99..b6500c1 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -2282,7 +2282,7 @@
// TODO(halcanary): de-dupe this by caching filtered images.
// (maybe in the resource cache?)
}
- SkAutoTUnref<SkPDFObject> pdfimage(fCanon->findPDFBitmap(image));
+ SkAutoTUnref<SkPDFObject> pdfimage(SkSafeRef(fCanon->findPDFBitmap(image)));
if (!pdfimage) {
pdfimage.reset(SkPDFCreateBitmapObject(image));
if (!pdfimage) {
@@ -2290,6 +2290,6 @@
}
fCanon->addPDFBitmap(image->uniqueID(), pdfimage);
}
- SkPDFUtils::DrawFormXObject(this->addXObjectResource(SkRef(pdfimage.get())),
+ SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()),
&content.entry()->fContent);
}