Zero memory after test (#150)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd2be4d..4ffcbbb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
 # Changelog
 
+## 2.0.1
+
+Only zero out memory on successful allocation on Windows.
+Upgrade test dev dependency.
+
 ## 2.0.0
 
 Switch Windows memory allocation to use `CoTaskMemAlloc` and `CoTaskMemFree`,
diff --git a/lib/src/allocation.dart b/lib/src/allocation.dart
index 91c8411..8b58884 100644
--- a/lib/src/allocation.dart
+++ b/lib/src/allocation.dart
@@ -128,13 +128,15 @@
     Pointer<T> result;
     if (Platform.isWindows) {
       result = winCoTaskMemAlloc(byteCount).cast();
-      _zeroMemory(result, byteCount);
     } else {
       result = posixCalloc(byteCount, 1).cast();
     }
     if (result.address == 0) {
       throw ArgumentError('Could not allocate $byteCount bytes.');
     }
+    if (Platform.isWindows) {
+      _zeroMemory(result, byteCount);
+    }
     return result;
   }
 
diff --git a/pubspec.yaml b/pubspec.yaml
index 5fb789f..33c792c 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: ffi
-version: 2.0.0
+version: 2.0.1
 description: Utilities for working with Foreign Function Interface (FFI) code.
 repository: https://github.com/dart-lang/ffi
 
@@ -7,5 +7,5 @@
   sdk: '>=2.17.0 <3.0.0'
 
 dev_dependencies:
-  test: ^1.21.1
+  test: ^1.21.2
   lints: ^2.0.0
diff --git a/test/allocation_test.dart b/test/allocation_test.dart
index 7bb685a..3fbb82d 100644
--- a/test/allocation_test.dart
+++ b/test/allocation_test.dart
@@ -21,4 +21,21 @@
       calloc.free(mem);
     }
   });
+
+  test('testPointerAllocateTooLarge', () {
+    // Try to allocate something that doesn't fit in 64 bit address space.
+    int maxInt = 9223372036854775807; // 2^63 - 1
+    expect(() => calloc<Uint8>(maxInt), throwsA(isA<ArgumentError>()));
+
+    // Try to allocate almost the full 64 bit address space.
+    int maxInt1_8 = 1152921504606846975; // 2^60 -1
+    expect(() => calloc<Uint8>(maxInt1_8), throwsA(isA<ArgumentError>()));
+  });
+
+  test('testPointerAllocateNegative', () {
+    // Passing in -1 will be converted into an unsigned integer. So, it will try
+    // to allocate SIZE_MAX - 1 + 1 bytes. This will fail as it is the max
+    // amount of addressable memory on the system.
+    expect(() => calloc<Uint8>(-1), throwsA(isA<ArgumentError>()));
+  });
 }