急问:这段程序释放内存时为啥出有关问题?多谢

急问:这段程序释放内存时为啥出问题?谢谢#includecstring#includeiostreamusingstd::coutusingstd::e

急问:这段程序释放内存时为啥出问题?谢谢
#include   <cstring>
#include   <iostream>

using   std::cout;
using   std::endl;

int   main()
{
char   s[]   =   "biaobiao;liyan;lijianjun ";
char   sep[]   =   "; ";
char*   strPtr[20];
int   strCnt   =   0;
char   *   result;

result   =   strtok(s,sep);
while(result   !=   NULL)
{
strPtr[strCnt]   =   new   char[strlen(result)];
strcpy(strPtr[strCnt],   result);
strCnt++;
result   =   strtok(NULL,sep);
}
for(int   i   =   0;   i <   strCnt;   i++)
{
cout < <strPtr[i];
}
cout   < <   endl;
for(i   =   0;   i <   strCnt;   i++)
{
delete   []   strPtr[i];
}
return   0;
}

[解决办法]
1.
strPtr[strCnt] = new char[strlen(result)];
====>
strPtr[strCnt] = new char[strlen(result)+1];

2.
delete [] strPtr[i];
===>
delete strPtr[i];

[解决办法]
要注意字符串结尾处有一个 '\0 '占用一个额外内存