src: fix bug in MallocedBuffer constructor

This should be a generic type even though we are
currently only using `char` as `T`.

PR-URL: https://github.com/nodejs/node/pull/23434
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Tobias Nießen 2018-10-11 17:01:17 -07:00 committed by Anna Henningsen
parent d3d6cd3eca
commit 714c1b88d2
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -443,7 +443,7 @@ struct MallocedBuffer {
MallocedBuffer() : data(nullptr) {}
explicit MallocedBuffer(size_t size) : data(Malloc<T>(size)), size(size) {}
MallocedBuffer(char* data, size_t size) : data(data), size(size) {}
MallocedBuffer(T* data, size_t size) : data(data), size(size) {}
MallocedBuffer(MallocedBuffer&& other) : data(other.data), size(other.size) {
other.data = nullptr;
}