dbbuilder: Remove dead decrement

This was caught by clang's scan-build.
cangjie: Free memory on errors

These were caught by clang's scan-build.
cangjie: Free memory earlier

This avoids a potential memory leak on an error condition further down
the road.

This was caught by clang's scan-build.
cangjie: Drop a dead assignment

This was caught by clang's scan-build.
Merge pull request #52 from Cangjians/scan-build

Some code correctness improvements