TObjArray Delete() method not working?

std::vectorstd::string treeNameVector;
treeNameVector.push_back(“ABC”);
treeNameVector.push_back(“DEF”);
treeNameVector.push_back(“GHI”);

void Graph()
{
TFile *f1 = new TFile(“Tree.root”);
for(int i=0;i<treeNameVector.size();i++)
{
TTree T1 = (TTree)f1->Get(treeNameVector.at(i).c_str());
T1->AddFriend(“DEF”, “Tree.root”);
T1->AddFriend(“GHI”, “Tree.root”);

TCanvas *c = new TCanvas(treeNameVector.at(i).c_str(), treeNameVector.at(i).c_str(), 0, 0, 1000, 1000);

TObjArray branches = new TObjArray(0);
branches = T1->GetListOfBranches();
int nbranches = branches->GetEntries();
cout << "Number of Branches = " << nbranches << endl;
for (int i = 0; i < nbranches; ++i)
{
string branchname = ((TBranch
)(*branches)[i])->GetName();
cout << "Branch Name = " << branchname << endl;

}