Memory allocation issue detected by coverity CID 25814