Open mlabour opened 8 years ago
As far as I can tell from looking at the code, these Utf8String
s are never deleted and will therefore leak. The above suggestion ought to work, as should this:
uint32_t ipnum = _GeoIP_lookupaddress(*Nan::Utf8String(info[0]));
Actually, it used to be that way, but was changed in b2efc95d093c4aff9057fe6c7a43702f8d0d23cb. If there actually was a segmentation fault somewhere, it means that libgeoip does something wrong or strange with strings passed in. Does it try to free them or does it store the pointer for future use?
On https://github.com/kuno/GeoIP/blob/master/src/org.cc at line 74
Why having static Nan::Utf8String *host_cstr = new Nan::Utf8String(info[0]); Instead of Nan::Utf8String host_cstr(info[0]);
Thank you