defer in loop may cause resource leak
defer statement executes only when function return, and the resource still be hold during loop. Release the resource manually when not needed.
Showing
+2 -1
Please register or sign in to comment
defer statement executes only when function return, and the resource still be hold during loop. Release the resource manually when not needed.