Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
crypto: fix 'var may be used uninitialized' compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Nov 15, 2011
1 parent b9e1bb3 commit cf2ee19
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/node_crypto.cc
Expand Up @@ -2156,14 +2156,17 @@ class Cipher : public ObjectWrap {

HandleScope scope;

unsigned char* out_value;
int out_len;
unsigned char* out_value = NULL;
int out_len = -1;
char* out_hexdigest;
int out_hex_len;
Local<Value> outString ;

int r = cipher->CipherFinal(&out_value, &out_len);

assert(out_value != NULL);
assert(out_len != -1);

if (out_len == 0 || r == 0) {
return scope.Close(String::New(""));
}
Expand Down Expand Up @@ -2576,12 +2579,15 @@ class Decipher : public ObjectWrap {

Decipher *cipher = ObjectWrap::Unwrap<Decipher>(args.This());

unsigned char* out_value;
int out_len;
unsigned char* out_value = NULL;
int out_len = -1;
Local<Value> outString;

int r = cipher->DecipherFinal(&out_value, &out_len, false);

assert(out_value != NULL);
assert(out_len != -1);

if (out_len == 0 || r == 0) {
return scope.Close(String::New(""));
}
Expand Down Expand Up @@ -2826,14 +2832,17 @@ class Hmac : public ObjectWrap {

HandleScope scope;

unsigned char* md_value;
unsigned int md_len;
unsigned char* md_value = NULL;
unsigned int md_len = -1;
char* md_hexdigest;
int md_hex_len;
Local<Value> outString ;

int r = hmac->HmacDigest(&md_value, &md_len);

assert(md_value != NULL);
assert(md_len != -1);

if (md_len == 0 || r == 0) {
return scope.Close(String::New(""));
}
Expand Down

0 comments on commit cf2ee19

Please sign in to comment.