aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre@debian.org>2016-11-08 10:00:45 +0000
committerSylvestre Ledru <sylvestre@debian.org>2016-11-08 10:00:45 +0000
commit3ce346d4caa7b8512ce183273184d9eca9a8564a (patch)
tree0016bf79bf377a413968fa25f0aa8e277e559073 /llvm/lib/Support/APFloat.cpp
parent7783ea6a6104dc10360d227a74ee638b40f47ceb (diff)
downloadllvm-3ce346d4caa7b8512ce183273184d9eca9a8564a.zip
llvm-3ce346d4caa7b8512ce183273184d9eca9a8564a.tar.gz
llvm-3ce346d4caa7b8512ce183273184d9eca9a8564a.tar.bz2
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 llvm-svn: 286223
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index fa56eda..20fd564 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/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);