diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-08-12 13:17:03 -0400 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-08-12 13:17:03 -0400 |
commit | f5d77a1bc21a61c12adb8b1254951a12b26db9e0 (patch) | |
tree | fe4ef8e3a02fc174ee48b77a080e2085ff69a10a /node | |
parent | 93a7eef2a5cae22474732a4c077213ca0512be46 (diff) | |
download | infinitytier-f5d77a1bc21a61c12adb8b1254951a12b26db9e0.tar.gz infinitytier-f5d77a1bc21a61c12adb8b1254951a12b26db9e0.zip |
Clean up a bunch of valgrind errors, nix a potentially unsafe op in Buffer assignment operator.
Diffstat (limited to 'node')
-rw-r--r-- | node/Buffer.hpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/node/Buffer.hpp b/node/Buffer.hpp index ed463bf6..14dd05c3 100644 --- a/node/Buffer.hpp +++ b/node/Buffer.hpp @@ -124,7 +124,7 @@ public: { if (b._l > C) throw std::out_of_range("Buffer: assignment from buffer larger than capacity"); - memcpy(this,&b,sizeof(_l) + b._l); // one memcpy for all fields + memcpy(_b,b._b,_l = b._l); return *this; } @@ -358,6 +358,15 @@ public: } /** + * Unconditionally zero buffer's underlying memory + */ + inline void zeroAll() + throw() + { + memset(_b,0,sizeof(_b)); + } + + /** * @return Size of data in buffer */ inline unsigned int size() const throw() { return _l; } |