libthr pshared: correct a bug in allocation
PR: 269277
(cherry picked from commit 25c862ae503a1c99458f4e055fd50c878fadbea3)