Browse Source

src: fix potential memory leak on early return

v0.10.5-release
mscdex 12 years ago
committed by Fedor Indutny
parent
commit
c4379a5554
  1. 6
      src/node_crypto.cc

6
src/node_crypto.cc

@ -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…
Cancel
Save