From: Dan Nicolaescu <dann@ics.uci.edu>
Subject: Problem report #46
Date: Sun, 30 Apr 2006 09:44:46 -0700 [thread overview]
Message-ID: <200604301644.k3UGik2H029021@scanner2.ics.uci.edu> (raw)
This looks like it might be a duplicate of #45
CID: 46
Checker: RESOURCE_LEAK (help)
File: emacs/lib-src/etags.c
Function: Erlang_functions
Description: Variable "last" not freed or pointed-to in function "strncpy"
5575 static void
5576 Erlang_functions (inf)
5577 FILE *inf;
5578 {
5579 char *cp, *last;
5580 int len;
5581 int allocated;
5582
5583 allocated = 0;
5584 len = 0;
5585 last = NULL;
5586
At conditional (1): "feof == 0" taking true path
At conditional (2): "((readline), (cp = (lb).buffer)), (1 != 0)" taking true path
5587 LOOP_ON_INPUT_LINES (inf, lb, cp)
5588 {
At conditional (3): "*(cp + 0) == 0" taking false path
5589 if (cp[0] == '\0') /* Empty line */
5590 continue;
At conditional (4): "_wht[*(cp + 0) & 255] != 0" taking false path
5591 else if (iswhite (cp[0])) /* Not function nor attribute */
5592 continue;
At conditional (5): "*(cp + 0) == 37" taking false path
5593 else if (cp[0] == '%') /* comment */
5594 continue;
At conditional (6): "*(cp + 0) == 34" taking false path
5595 else if (cp[0] == '"') /* Sometimes, strings start in column one */
5596 continue;
At conditional (7): "*(cp + 0) == 45" taking true path
5597 else if (cp[0] == '-') /* attribute, e.g. "-define" */
5598 {
5599 erlang_attribute (cp);
Event overwrite_var: Value "last" is overwritten in "last = 0"
Also see events: [alloc_fn][var_assign][pass_arg]
5600 last = NULL;
5601 }
5602 else if ((len = erlang_func (cp, last)) > 0)
5603 {
5604 /*
5605 * Function. Store the function name so that we only
5606 * generates a tag for the first clause.
5607 */
5608 if (last == NULL)
Event alloc_fn: Called allocation function "xmalloc" [model]
Event var_assign: Assigned variable "last" to storage returned from "xmalloc"
Also see events: [var_assign][overwrite_var][pass_arg]
5609 last = xnew (len + 1, char);
5610 else if (len + 1 > allocated)
5611 xrnew (last, len + 1, char);
5612 allocated = len + 1;
Event pass_arg: Variable "last" not freed or pointed-to in function "strncpy"
Also see events: [alloc_fn][var_assign][overwrite_var]
5613 strncpy (last, cp, len);
5614 last[len] = '\0';
5615 }
5616 }
5617 }
next reply other threads:[~2006-04-30 16:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-30 16:44 Dan Nicolaescu [this message]
2006-05-02 16:46 ` Problem report #46 Dan Nicolaescu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200604301644.k3UGik2H029021@scanner2.ics.uci.edu \
--to=dann@ics.uci.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.