Use g_try_malloc_n where it makes sense

This lets us avoid some manual overflow checks.