test-socket-util: avoid "memleak" reported by valgrind
valgrind reports the allocation done in the short-lived child as a leak.
Let's restructure the code to avoid this.
(cherry picked from commit 181c4ba750770b54a54b5abbe8ae8ff4f6db59b5)
Resolves: #1683319
patch_name: 0182-test-socket-util-avoid-memleak-reported-by-valgrind.patch
present_in_specfile: true
location_in_specfile: 182
squash_commits: true