[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem report #49
From: |
Dan Nicolaescu |
Subject: |
Problem report #49 |
Date: |
Sun, 30 Apr 2006 09:49:16 -0700 |
This is the last one, all the problem reports that still need to be
analyzed have been posted here now.
CID: 49
Checker: RESOURCE_LEAK (help)
File: emacs/lib-src/etags.c
Function: Prolog_functions
Description: Variable "last" not freed or pointed-to in function "strncpy"
5411 static void
5412 Prolog_functions (inf)
5413 FILE *inf;
5414 {
5415 char *cp, *last;
5416 int len;
5417 int allocated;
5418
5419 allocated = 0;
5420 len = 0;
5421 last = NULL;
5422
At conditional (1): "feof == 0" taking true path
At conditional (2): "((readline), (cp = (lb).buffer)), (1 != 0)" taking true
path
At conditional (4): "feof == 0" taking false path
5423 LOOP_ON_INPUT_LINES (inf, lb, cp)
5424 {
At conditional (3): "*(cp + 0) == 0" taking true path
5425 if (cp[0] == '\0') /* Empty line */
5426 continue;
5427 else if (iswhite (cp[0])) /* Not a predicate */
5428 continue;
5429 else if (cp[0] == '/' && cp[1] == '*') /* comment. */
5430 prolog_skip_comment (&lb, inf);
5431 else if ((len = prolog_pr (cp, last)) > 0)
5432 {
5433 /* Predicate or rule. Store the function name so that we
5434 only generate a tag for the first clause. */
5435 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][leaked_storage][pass_arg]
5436 last = xnew(len + 1, char);
5437 else if (len + 1 > allocated)
5438 xrnew (last, len + 1, char);
5439 allocated = len + 1;
Event pass_arg: Variable "last" not freed or pointed-to in function "strncpy"
Also see events: [alloc_fn][var_assign][leaked_storage]
5440 strncpy (last, cp, len);
5441 last[len] = '\0';
5442 }
5443 }
Event leaked_storage: Returned without freeing storage "last"
Also see events: [alloc_fn][var_assign][pass_arg]
5444 }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Problem report #49,
Dan Nicolaescu <=