Skip to content

Commit

Permalink
Merge ee76e39 into 4e057fd
Browse files Browse the repository at this point in the history
  • Loading branch information
nomis52 committed Dec 24, 2014
2 parents 4e057fd + ee76e39 commit 319cebc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 8 additions & 4 deletions common/io/IOStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,21 @@ void IOStack::Purge() {
* Dump this IOStack as a human readable string
*/
void IOStack::Dump(std::ostream *output) {
unsigned int length = 0;
BlockVector::const_iterator iter = m_blocks.begin();
for (; iter != m_blocks.end(); ++iter) {
length += (*iter)->Size();
}

// For now just alloc memory for the entire thing
unsigned int length = Size();
uint8_t *tmp = new uint8_t[length];

unsigned int offset = 0;
BlockVector::const_iterator iter = m_blocks.begin();
for (; iter != m_blocks.end(); ++iter) {
for (iter = m_blocks.begin(); iter != m_blocks.end(); ++iter) {
offset += (*iter)->Copy(tmp + offset, length - offset);
}

ola::FormatData(output, tmp, length);
ola::FormatData(output, tmp, offset);
delete[] tmp;
}

Expand Down
12 changes: 12 additions & 0 deletions include/ola/base/FlagsPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ class Flag : public BaseFlag {
m_name = NewCanonicalName(name);
}

~Flag() {
delete[] m_name;
}

const char *name() const { return m_name; }
bool has_arg() const { return true; }
bool default_value() const { return m_default; }
Expand Down Expand Up @@ -206,6 +210,10 @@ class Flag<bool> : public BaseFlag {
}
}

~Flag() {
delete[] m_name;
}

const char *name() const { return m_name; }
bool has_arg() const { return m_has_arg; }
bool default_value() const { return m_default; }
Expand Down Expand Up @@ -252,6 +260,10 @@ class Flag<std::string> : public BaseFlag {
m_name = NewCanonicalName(name);
}

~Flag() {
delete[] m_name;
}

const char *name() const { return m_name; }
bool has_arg() const { return true; }
std::string default_value() const { return m_default; }
Expand Down

0 comments on commit 319cebc

Please sign in to comment.