lib: avoid creating a throw away object in validateObject
#39807
+14
−5
validateObject
#39807