[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
empty input for fakemail.c
From: |
Dan Nicolaescu |
Subject: |
empty input for fakemail.c |
Date: |
Fri, 28 Apr 2006 09:12:34 -0700 |
AFAICS this Coverity problem report can happen if the input file is
empty. What should be done in that case exit (1)?
Can someone familiar with this code take a look?
CID: 9
Checker: FORWARD_NULL (help)
File: emacs/lib-src/fakemail.c
Function: read_header
Description: Variable "the_header " tracked as NULL was dereferenced.
Event assign_zero: Variable "the_header " assigned value 0.
Also see events: [var_deref_op]
651 register header the_header = ((header) NULL);
652 register line_list *next_line = ((line_list *) NULL);
653
654 init_linebuffer (&lb);
655
656 do
657 {
658 long length;
659 register char *line;
660
661 readline (&lb, stdin);
662 line = lb.buffer;
663 length = strlen
(line);
At conditional (1): "length == 0 " taking true path
664 if (length == 0) break;
665
666 if (has_keyword (line))
667 {
668 register header old = the_header;
669 the_header = new_header
();
670 if (old == ((header) NULL))
671 {
672 the_header->next = the_header;
673
the_header->previous = the_header;
674 }
675 else
676 {
677
the_header->previous = old;
678 the_header->next = old->next;
679 old->next =
the_header;
680 }
681 next_line = & (the_header->text);
682 }
683
684 if (next_line == ((line_list
*) NULL))
685 {
686 /* Not a valid header */
687 exit (EXIT_FAILURE);
688 }
689 *next_line = new_list ();
690 (*next_line)->string =
alloc_string (length);
691 strcpy (((*next_line)->string), line);
692 next_line = & ((*next_line)->continuation);
693 *next_line = NIL;
694
695 } while (true);
696
Event var_deref_op: Variable "the_header " tracked as NULL was
dereferenced.
Also see events: [assign_zero]
697 return the_header->next;
698 }
- empty input for fakemail.c,
Dan Nicolaescu <=