From: Sylvestre Ledru Date: Tue, 8 Nov 2016 10:00:45 +0000 (+0000) Subject: Fix memory leaks (coverity issues 1365586 & 1365591) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=20b341aa05748a07ae1c2f592a7a81c0062410be;p=llvm Fix memory leaks (coverity issues 1365586 & 1365591) Reviewers: hfinkel Subscribers: george.burgess.iv, malcolm.parsons, boris.ulasevich, llvm-commits Differential Revision: https://reviews.llvm.org/D26347 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286223 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index fa56edad02b..20fd564a23a 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -1686,8 +1686,10 @@ IEEEFloat::opStatus IEEEFloat::remainder(const IEEEFloat &rhs) { bool ignored; fs = V.convertToInteger(x, parts * integerPartWidth, true, rmNearestTiesToEven, &ignored); - if (fs==opInvalidOp) + if (fs==opInvalidOp) { + delete[] x; return fs; + } fs = V.convertFromZeroExtendedInteger(x, parts * integerPartWidth, true, rmNearestTiesToEven); @@ -1724,8 +1726,10 @@ IEEEFloat::opStatus IEEEFloat::mod(const IEEEFloat &rhs) { bool ignored; fs = V.convertToInteger(x, parts * integerPartWidth, true, rmTowardZero, &ignored); - if (fs==opInvalidOp) + if (fs==opInvalidOp) { + delete[] x; return fs; + } fs = V.convertFromZeroExtendedInteger(x, parts * integerPartWidth, true, rmNearestTiesToEven);