mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
Merge pull request #504 from jpilet/master
Fix a memory leak in SerialportPoller::New
This commit is contained in:
commit
deee0285f7
1 changed files with 3 additions and 3 deletions
|
|
@ -76,18 +76,18 @@ void SerialportPoller::Init(Handle<Object> target) {
|
|||
NAN_METHOD(SerialportPoller::New) {
|
||||
NanScope();
|
||||
|
||||
SerialportPoller* obj = new SerialportPoller();
|
||||
|
||||
if(!args[0]->IsInt32()) {
|
||||
NanThrowTypeError("First argument must be an fd");
|
||||
NanReturnUndefined();
|
||||
}
|
||||
obj->fd_ = args[0]->ToInt32()->Int32Value();
|
||||
|
||||
if(!args[1]->IsFunction()) {
|
||||
NanThrowTypeError("Third argument must be a function");
|
||||
NanReturnUndefined();
|
||||
}
|
||||
|
||||
SerialportPoller* obj = new SerialportPoller();
|
||||
obj->fd_ = args[0]->ToInt32()->Int32Value();
|
||||
obj->callback_ = new NanCallback(args[1].As<v8::Function>());
|
||||
// obj->callCallback();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue