Fixed some dynamic data examples

Fixed some issues about to free all the memory reserved