mirror of https://github.com/nodejs/node.git
src: fix potential memory leak on early return
parent
2322580dfb
commit
c4379a5554
|
@ -3009,9 +3009,6 @@ class Sign : public ObjectWrap {
|
|||
unsigned int md_len;
|
||||
Local<Value> outString;
|
||||
|
||||
md_len = 8192; // Maximum key size is 8192 bits
|
||||
md_value = new unsigned char[md_len];
|
||||
|
||||
ASSERT_IS_BUFFER(args[0]);
|
||||
ssize_t len = Buffer::Length(args[0]);
|
||||
|
||||
|
@ -3019,6 +3016,9 @@ class Sign : public ObjectWrap {
|
|||
ssize_t written = DecodeWrite(buf, len, args[0], BUFFER);
|
||||
assert(written == len);
|
||||
|
||||
md_len = 8192; // Maximum key size is 8192 bits
|
||||
md_value = new unsigned char[md_len];
|
||||
|
||||
int r = sign->SignFinal(&md_value, &md_len, buf, len);
|
||||
if (r == 0) {
|
||||
md_value = NULL;
|
||||
|
|
Loading…
Reference in New Issue