uni

University stuff
git clone git://git.christosmarg.xyz/uni-assignments.git
Log | Files | Refs | README | LICENSE

commit b7cffe29333bd24fc72193978d002ace21dd2981
parent cc930be2d7d4f8c9a0cb2b9fac17155f1de620cc
Author: Christos Margiolis <christos@margiolis.net>
Date:   Thu,  7 May 2020 07:48:20 +0300

fixed a memory leak in the append methods

Diffstat:
Massignment-2.5-spreadsheets/bin/spreadsheets | 0
Massignment-2.5-spreadsheets/obj/main.o | 0
Massignment-2.5-spreadsheets/obj/xstring.o | 0
Massignment-2.5-spreadsheets/src/xstring.cpp | 4++++
4 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/assignment-2.5-spreadsheets/bin/spreadsheets b/assignment-2.5-spreadsheets/bin/spreadsheets Binary files differ. diff --git a/assignment-2.5-spreadsheets/obj/main.o b/assignment-2.5-spreadsheets/obj/main.o Binary files differ. diff --git a/assignment-2.5-spreadsheets/obj/xstring.o b/assignment-2.5-spreadsheets/obj/xstring.o Binary files differ. diff --git a/assignment-2.5-spreadsheets/src/xstring.cpp b/assignment-2.5-spreadsheets/src/xstring.cpp @@ -182,6 +182,8 @@ xstring& xstring::append(const xstring& s, std::size_t i) std::copy(tmp2, tmp2 + len - i + 1, str + s.len + i); len = length(); str[len] = '\0'; + delete[] tmp1; + delete[] tmp2; } return *this; } @@ -212,6 +214,8 @@ xstring& xstring::append(const char *s, std::size_t i) std::copy(tmp2, tmp2 + len - i + 1, str + strlen(s) + i); len = length(); str[len] = '\0'; + delete[] tmp1; + delete[] tmp2; } return *this; }