Issue #179: try fixing memory leak
Fix typecasting for upclass
Merge pull request #273 from develersrl/master

Fixes #179: fix memory leak of poll_handle object