Added some missing free() calls