Backport upstream commit 54392c4df604f20 to fix an incorrect obstack allocation that wold lead to memory corruption (RHBZ 2237392).