diff options
Diffstat (limited to 'src/libutil/serialise.cc')
-rw-r--r-- | src/libutil/serialise.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libutil/serialise.cc b/src/libutil/serialise.cc index 24c6d107359e..a68f7a0fa8ee 100644 --- a/src/libutil/serialise.cc +++ b/src/libutil/serialise.cc @@ -3,6 +3,7 @@ #include <cstring> #include <cerrno> +#include <memory> namespace nix { @@ -236,11 +237,10 @@ size_t readString(unsigned char * buf, size_t max, Source & source) string readString(Source & source) { size_t len = readInt(source); - unsigned char * buf = new unsigned char[len]; - AutoDeleteArray<unsigned char> d(buf); - source(buf, len); + auto buf = std::make_unique<unsigned char[]>(len); + source(buf.get(), len); readPadding(len, source); - return string((char *) buf, len); + return string((char *) buf.get(), len); } Source & operator >> (Source & in, string & s) |