Explorar o código

fpPDF: fix memory leak in TPDFImages.AddFromStream for KeepImage=True

git-svn-id: trunk@43471 -
ondrej %!s(int64=6) %!d(string=hai) anos
pai
achega
2f244383be
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      packages/fcl-pdf/src/fppdf.pp

+ 4 - 2
packages/fcl-pdf/src/fppdf.pp

@@ -3213,10 +3213,12 @@ begin
       Reader.Free;
     end;
     IP.Image:=I;
-    if Not KeepImage then
+    if KeepImage then
+      IP.OwnsImage := True
+    else
       begin
       IP.CreateStreamedData(Owner.ImageStreamOptions);
-      IP.FImage:=Nil; // not through property, that would clear the image
+      IP.DetachImage; // not through property, that would clear the image
       i.Free;
       end;
   end;