Properly compute the size argument to pass to malloc().
Reported by: Coverity CID: 1198856 MFC after: 1 week