set released pointer to nullptr.

master
FengJungle 2022-03-10 07:53:38 +08:00
parent df4294e6b8
commit 72d36140b3
7 changed files with 25 additions and 0 deletions

View File

@ -41,6 +41,12 @@ int main()
delete fangdong3;
delete jungle;
delete jianmengtu;
mediator = nullptr;
fangdong1 = nullptr;
fangdong2 = nullptr;
fangdong3 = nullptr;
jungle = nullptr;
jianmengtu = nullptr;
return 0;
}

View File

@ -43,6 +43,8 @@ int main()
delete Jungle;
delete codeVer;
Jungle = nullptr;
codeVer = nullptr;
return 0;
}

View File

@ -34,6 +34,11 @@ int main()
delete Single;
delete Jianmengtu;
delete SillyDog;
controller = nullptr;
Jungle = nullptr;
Single = nullptr;
Jianmengtu = nullptr;
SillyDog = nullptr;
return 0;
}

View File

@ -14,6 +14,7 @@ int main()
system("pause");
delete jungle;
jungle = nullptr;
return 0;
}

View File

@ -26,6 +26,7 @@ int main()
system("pause");
delete ctx;
ctx = nullptr;
return 0;
}

View File

@ -6,14 +6,17 @@ int main()
FingerprintModule *fp = new FingerprintModuleA();
fp->algorithm();
delete fp;
fp = nullptr;
fp = new FingerprintModuleB();
fp->algorithm();
delete fp;
fp = nullptr;
fp = new FingerprintModuleC();
fp->algorithm();
delete fp;
fp = nullptr;
printf("\n\n");
system("pause");

View File

@ -39,6 +39,13 @@ int main()
delete cashier;
delete jungle;
delete shoppingCart;
apple1 = nullptr;
apple2 = nullptr;
book1 = nullptr;
book2 = nullptr;
cashier = nullptr;
jungle = nullptr;
shoppingCart = nullptr;
return 0;
}