fix a memory leak bug, refactor some codes
Merge branch 'master' of https://github.com/intel-hadoop/diceros