Merge pull request #1273 from gowthamsk-arm/mem-alloc-cleanup-2.28

Backport 2.28: Fix: Memory allocation cleanup in internal crypto api functions