summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-29 15:01:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-30 08:31:13 +0200
commitab6da907521514cfa85eb8e5786a9c9bae3ceb2e (patch)
tree30993a6faf9826f547866c5b15791bfa06db94d9
parent27d03cc31acb6a3c06dc56ac0a45a56062b873ec (diff)
use realloc instead of malloc+memcpy
Change-Id: Ia69be8db2b735c28cc69f478efcff3b6a2cdbbf2 Reviewed-on: https://gerrit.libreoffice.org/59775 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--vcl/source/filter/igif/decode.cxx7
1 files changed, 2 insertions, 5 deletions
diff --git a/vcl/source/filter/igif/decode.cxx b/vcl/source/filter/igif/decode.cxx
index 8cbb52c9f9d8..276d75c64e24 100644
--- a/vcl/source/filter/igif/decode.cxx
+++ b/vcl/source/filter/igif/decode.cxx
@@ -79,13 +79,10 @@ Scanline GIFLZWDecompressor::DecompressBlock( sal_uInt8* pSrc, sal_uInt8 cBufSiz
{
sal_uLong nNewSize = nTargetSize << 1;
sal_uLong nOffset = pTmpTarget - pTarget;
- sal_uInt8* pTmp = static_cast<sal_uInt8*>(std::malloc( nNewSize ));
-
- memcpy( pTmp, pTarget, nTargetSize );
- std::free( pTarget );
+ pTarget = static_cast<sal_uInt8*>(std::realloc( pTarget, nNewSize ));
nTargetSize = nNewSize;
- pTmpTarget = ( pTarget = pTmp ) + nOffset;
+ pTmpTarget = pTarget + nOffset;
}
memcpy( pTmpTarget, pOutBufData, nOutBufDataLen );