Fix incorrect size computation

This defect was detected with Cppcheck static analyzer. The original code simply makes no sense.