Skip to content

Instantly share code, notes, and snippets.

@agesome
Created June 26, 2009 10:45
Show Gist options
  • Save agesome/136412 to your computer and use it in GitHub Desktop.
Save agesome/136412 to your computer and use it in GitHub Desktop.
evgeny@lamarr:~/code$ splint defineproc/defineproc.c
Splint 3.1.2 --- 16 Mar 2008
defineproc/defineproc.c: (in function hash)
defineproc/defineproc.c:35:15: Incompatible types for + (unsigned int, char):
hashval + *str
To make char and int types equivalent, use +charint.
defineproc/defineproc.c: (in function search)
defineproc/defineproc.c:45:18: Function returns with global root referencing
released storage
A global variable does not satisfy its annotations when control is
transferred. (Use -globstate to inhibit warning)
defineproc/defineproc.c:45:14: Storage root released
defineproc/defineproc.c:46:10: Null storage returned as non-null: NULL
Function returns a possibly null pointer, but is not declared using
/*@null@*/ annotation of result. If function may return NULL, add /*@null@*/
annotation to the return value declaration. (Use -nullret to inhibit warning)
defineproc/defineproc.c: (in function install)
defineproc/defineproc.c:52:21: Unrecognized identifier: strdup
Identifier used in code has not been declared. (Use -unrecog to inhibit
warning)
defineproc/defineproc.c:52:5: Implicitly only storage current->name (type char
*) not released before assignment: current->name = strdup(name)
A memory leak has been detected. Only-qualified storage is not released
before the last reference to it is lost. (Use -mustfreeonly to inhibit
warning)
defineproc/defineproc.c:53:5: Implicitly only storage current->def (type char
*) not released before assignment: current->def = strdup(def)
defineproc/defineproc.c:55:5: Implicitly only storage current->next (type
struct dobj *) not released before assignment:
current->next = (dobj *)malloc(sizeof(dobj))
defineproc/defineproc.c:56:5: Only storage current->next assigned to
unqualified: current = current->next
The only reference to this storage is transferred to another reference (e.g.,
by returning it) that does not have the only annotation. This may lead to a
memory leak, since the new reference is not necessarily released. (Use
-onlytrans to inhibit warning)
defineproc/defineproc.c:62:2: Function returns with non-null global current
referencing null storage
defineproc/defineproc.c:56:15: Storage current may become null
defineproc/defineproc.c: (in function main)
defineproc/defineproc.c:71:14: Function returns with non-null global root
referencing null storage
defineproc/defineproc.c:66:10: Storage root may become null
defineproc/defineproc.c:71:14: Function returns with non-null global current
referencing null storage
defineproc/defineproc.c:67:13: Storage current may become null
defineproc/defineproc.c:76:3: Owned storage current (type dobj *) not released
before assignment: current = root
defineproc/defineproc.c:67:3: Storage current becomes owned
defineproc/defineproc.c:77:16: Arrow access from possibly null pointer current:
current->next
A possibly null pointer is dereferenced. Value is either the result of a
function which may return null (in which case, code should check it is not
null), or a global, parameter or structure field declared with the null
qualifier. (Use -nullderef to inhibit warning)
defineproc/defineproc.c:76:13: Storage current may become null
defineproc/defineproc.c:77:9: Field current->next used before definition
An rvalue is used that may not be initialized to a value on some execution
path. (Use -usedef to inhibit warning)
defineproc/defineproc.c:78:26: Field current->name used before definition
defineproc/defineproc.c:78:41: Field current->def used before definition
defineproc/defineproc.c:79:5: Only storage current->next assigned to
unqualified: current = current->next
defineproc/defineproc.c:80:3: Variable current is dependent if loop is not
taken, but independent in while body.
The state of a variable is different depending on which branch is taken. This
means no annotation can sensibly be applied to the storage. (Use -branchstate
to inhibit warning)
defineproc/defineproc.c:80:3: if loop is not taken:
defineproc/defineproc.c:76:3: Storage current becomes dependent (through
alias root)
defineproc/defineproc.c:80:3: in while body:
defineproc/defineproc.c:76:3: Storage current becomes dependent (through
alias root)
defineproc/defineproc.c:82:12: Function returns with non-null global root
referencing null storage
defineproc/defineproc.c:66:10: Storage root may become null
defineproc/defineproc.c:82:12: Global storage *current contains 4 undefined
fields when call returns: def, name, next, hash
Storage derivable from a parameter, return value or global is not defined.
Use /*@out@*/ to denote passed or returned storage which need not be defined.
(Use -compdef to inhibit warning)
defineproc/defineproc.c:28:7: Variable exported but not used outside
defineproc: root
A declaration is exported, but not used outside this module. Declaration can
use static qualifier. (Use -exportlocal to inhibit warning)
defineproc/defineproc.c:28:14: Variable exported but not used outside
defineproc: current
defineproc/defineproc.c:31:1: Function exported but not used outside
defineproc: hash
defineproc/defineproc.c:37:1: Definition of hash
defineproc/defineproc.c:40:2: Function exported but not used outside
defineproc: search
defineproc/defineproc.c:47:1: Definition of search
defineproc/defineproc.c:49:6: Function exported but not used outside
defineproc: install
defineproc/defineproc.c:62:1: Definition of install
Finished checking --- 25 code warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment