Fix potential use of uninitialized value on linux (#5620)
Fix potential use of uninitialized value on linux (#5620)

* Fix potential use of uninitialized value on linux

* Better fix: remove exit/return pattern, ensure no errors will allocate buffer space

* Perform argument validation at the top of the function
nestlabs/connectedhomeip,nestlabs/connectedhomeip,project-chip/connectedhomeip,project-chip/connectedhomeip,project-chip/connectedhomeip,project-chip/connectedhomeip,nestlabs/connectedhomeip,nestlabs/connectedhomeip,nestlabs/connectedhomeip,project-chip/connectedhomeip,nestlabs/connectedhomeip,nestlabs/connectedhomeip,project-chip/connectedhomeip