Handle NULL return from MallocCString
This commit is contained in:
parent
539d3bae54
commit
287d7e67a3
@ -140,6 +140,11 @@ public:
|
|||||||
Connection *self = ObjectWrap::Unwrap<Connection>(args.This());
|
Connection *self = ObjectWrap::Unwrap<Connection>(args.This());
|
||||||
|
|
||||||
char* inputStr = MallocCString(args[0]);
|
char* inputStr = MallocCString(args[0]);
|
||||||
|
|
||||||
|
if(!inputStr) {
|
||||||
|
THROW("Unable to allocate memory for a string in EscapeIdentifier.")
|
||||||
|
}
|
||||||
|
|
||||||
char* escapedStr = self->EscapeIdentifier(inputStr);
|
char* escapedStr = self->EscapeIdentifier(inputStr);
|
||||||
free(inputStr);
|
free(inputStr);
|
||||||
|
|
||||||
@ -161,6 +166,11 @@ public:
|
|||||||
Connection *self = ObjectWrap::Unwrap<Connection>(args.This());
|
Connection *self = ObjectWrap::Unwrap<Connection>(args.This());
|
||||||
|
|
||||||
char* inputStr = MallocCString(args[0]);
|
char* inputStr = MallocCString(args[0]);
|
||||||
|
|
||||||
|
if(!inputStr) {
|
||||||
|
THROW("Unable to allocate memory for a string in EscapeIdentifier.")
|
||||||
|
}
|
||||||
|
|
||||||
char* escapedStr = self->EscapeLiteral(inputStr);
|
char* escapedStr = self->EscapeLiteral(inputStr);
|
||||||
free(inputStr);
|
free(inputStr);
|
||||||
|
|
||||||
@ -320,7 +330,7 @@ public:
|
|||||||
Connection *self = ObjectWrap::Unwrap<Connection>(args.This());
|
Connection *self = ObjectWrap::Unwrap<Connection>(args.This());
|
||||||
//TODO handle errors in some way
|
//TODO handle errors in some way
|
||||||
if (args.Length() < 1 && !Buffer::HasInstance(args[0])) {
|
if (args.Length() < 1 && !Buffer::HasInstance(args[0])) {
|
||||||
THROW("SendCopyFromChunk requires 1 Buffer argument");
|
THROW("SendCopyFromChunk requires 1 Buffer argument");
|
||||||
}
|
}
|
||||||
self->SendCopyFromChunk(args[0]->ToObject());
|
self->SendCopyFromChunk(args[0]->ToObject());
|
||||||
return Undefined();
|
return Undefined();
|
||||||
|
Loading…
Reference in New Issue
Block a user