title: free string in the setter
body: <p>Do I need to free the previously allocated string within the setter?</p>
  
  <pre><code>static void setType(Employee *self, const char *type) {
      if(self-&gt;type) free(self-&gt;type);
      self-&gt;type = strdup(type);
  }
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <pre><code>typedef struct Employee Employee;
  struct Employee {
      char *type;
      void *data;
      void (*display)(Employee *self);
  }
  
  void release(Employee *self) {
      free(self-&gt;type); //  required?
      free(self-&gt;display); // required?
      self-&gt;data = NULL; // required?
      free(self); 
  }
  </code></pre>
  
  <p><strong>Edit 2</strong></p>
  
  <p>Do I need to free the function pointers?</p>
  
  <pre><code>void display(Employee *self) {
       // display employee info
  }
  
  Employee employee = malloc(sizeof(Employee));
  employee-&gt;type = NULL;
  employee-&gt;data = someObject;
  employee-&gt;display = display;
  </code></pre>