]> The Tcpdump Group git mirrors - tcpdump/commitdiff
In reviewing tcpdump.c, I found a minor issue with a call to malloc()
authorBill Parker <[email protected]>
Mon, 3 Sep 2012 21:19:37 +0000 (17:19 -0400)
committerMichael Richardson <[email protected]>
Mon, 3 Sep 2012 21:23:05 +0000 (17:23 -0400)
failing to check it's return value in file 'tcpdump.c' in function
'MakeFileName'.  Here is the resulting patch below :)

tcpdump.c

index f21ec355943c8b0d817a801365bfd1ef1aedb037..41f952f2320ace011497940c1a735b8a6639049c 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -589,6 +589,8 @@ static void
 MakeFilename(char *buffer, char *orig_name, int cnt, int max_chars)
 {
         char *filename = malloc(NAME_MAX + 1);
+       if (filename == NULL)   /* didn't get memory requested  */
+        error("malloc of filename:");
 
         /* Process with strftime if Gflag is set. */
         if (Gflag != 0) {