]> granicus.if.org Git - neomutt/commitdiff
test: add memory tests for degenerate cases
authorRichard Russon <rich@flatcap.org>
Mon, 29 Apr 2019 13:46:56 +0000 (14:46 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 30 Apr 2019 10:22:04 +0000 (11:22 +0100)
test/memory/mutt_mem_free.c
test/memory/mutt_mem_realloc.c

index f62082643217d5e486dcfcf33ff319787a95a065..d31182adac2284316ee381a1f325f1fdefe3ca23 100644 (file)
 void test_mutt_mem_free(void)
 {
   // void mutt_mem_free(void *ptr);
+
+  {
+    mutt_mem_free(NULL);
+    TEST_CHECK_(1, "mutt_mem_free(NULL)");
+  }
+
+  {
+    void *ptr = NULL;
+    mutt_mem_free(&ptr);
+    TEST_CHECK_(1, "mutt_mem_free(&ptr)");
+  }
 }
index 1e18d32f917606c3c1b3b2cf65eec77e840d8caa..7e3afbdc1687087de9a9d4585dc663168fabf705 100644 (file)
@@ -28,4 +28,9 @@
 void test_mutt_mem_realloc(void)
 {
   // void mutt_mem_realloc(void *ptr, size_t size);
+
+  {
+    mutt_mem_realloc(NULL, 10);
+    TEST_CHECK_(1, "mutt_mem_realloc(NULL, 10)");
+  }
 }