Free "self" after use

- The "self" variable is now freed immediately after use.
- Removed initialization to NULL for "self" since it was not used before
  assignment.