[Fix #367] Check RPMTAG class before cast
Fixing librpm API usage leaks
Merge pull request #383 from theopolis/fix_rpm_packages

[Fix #367] Check RPMTAG class before cast