Yes, that's the correct way to do it.
Be sure to seperately deallocate the STRING before you deallocate the struct. Otherwise only the pointer (4 bytes) is deallocated, instead of the string it points to. You may tend to forget this, especially when you create a struct on the stack (inside a function) because the struct is deallocated automatically, but the string isn't!