fixe memory leaks and added the channel header managment

Change-Id: Ie6c25e05737c3251e97de4f3c7588ec31b7da773