fixed 2 minor issues in pretty.c
- now uses secure wrapper around malloc
- now actually checks all cases for precedence (forgot to add a
  couple before...)