Skip to content

Commit

Permalink
Fix memory leaks (coverity issues 1365586 & 1365591)
Browse files Browse the repository at this point in the history
Reviewers: hfinkel

Subscribers: george.burgess.iv, malcolm.parsons, boris.ulasevich, llvm-commits

Differential Revision: https://reviews.llvm.org/D26347

llvm-svn: 286223
  • Loading branch information
sylvestre committed Nov 8, 2016
1 parent 7783ea6 commit 3ce346d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions llvm/lib/Support/APFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3ce346d

Please sign in to comment.