Check for NULL return value from wtap_dump_open().
authorgram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 26 Apr 2006 17:31:56 +0000 (17:31 +0000)
committergram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 26 Apr 2006 17:31:56 +0000 (17:31 +0000)
Fixes coverity bug 159.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18005 f5534014-38df-0310-8fa8-9805f1628bb7

randpkt.c

index 965189b06b5d1e902a66575af350e304767a32e5..650b9dadc7f19a75e559fae521c986642a8ad3a0 100644 (file)
--- a/randpkt.c
+++ b/randpkt.c
@@ -483,6 +483,10 @@ main(int argc, char **argv)
 
        dump = wtap_dump_open(produce_filename, WTAP_FILE_PCAP,
                example->sample_wtap_encap, produce_max_bytes, FALSE /* compressed */, &err);
+    if (!dump) {
+        printf("Error writing to %s\n", produce_filename);
+        exit(1);
+    }
 
        seed();