Fix: RESOURCE_LEAK (CWE-404)
authorTomas Hozza <thozza@redhat.com>
Sun, 24 Feb 2013 10:37:49 +0000 (11:37 +0100)
committerHendrik Sattler <post@hendrik-sattler.de>
Sun, 24 Feb 2013 10:37:49 +0000 (11:37 +0100)
commitc23f2351cae3177527f826a2d9f593dbe09cd1f7
treeb4ec97b91ac7bad7fa4ac76b34f077364533cbfd
parent02442088c2781cb93ea065ac2a460b60a10a99f5
Fix: RESOURCE_LEAK (CWE-404)

Coverity output:
apps/ircp/ircp_client.c:281: cond_false: Condition "!(cli != NULL)", taking
 false branch
apps/ircp/ircp_client.c:281: if_end: End of if statement
apps/ircp/ircp_client.c:283: alloc_fn: Storage is returned from allocation
 function "build_object_from_file(obex_t *, char const *, char const *)".
apps/ircp/ircp_io.c:72:2: alloc_fn: Storage is returned from allocation
 function "OBEX_ObjectNew(obex_t *, uint8_t)".
apps/lib/obex.c:626:2: cond_false: Condition "!(self != NULL)", taking false
 branch
apps/lib/obex.c:626:2: if_end: End of if statement
apps/lib/obex.c:628:2: alloc_fn: Storage is returned from allocation function
 "obex_object_new(void)".
apps/lib/obex_object.c:46:2: alloc_fn: Storage is returned from allocation
 function "malloc(size_t)".
apps/lib/obex_object.c:46:2: var_assign: Assigning: "object" = "malloc(120UL)".
apps/lib/obex_object.c:47:2: cond_false: Condition "object == NULL", taking
 false branch
apps/lib/obex_object.c:48:3: if_end: End of if statement
apps/lib/obex_object.c:50:2: noescape: Resource "object" is not freed or
 pointed-to in function "memset(void *, int, size_t)".
apps/lib/obex_object.c:52:2: noescape: Resource "object" is not freed or
 pointed-to in function "obex_object_setrsp(obex_object_t *, uint8_t, uint8_t)".
apps/lib/obex_object.c:128:39: noescape:
 "obex_object_setrsp(obex_object_t *, uint8_t, uint8_t)" does not free or save
 its pointer parameter "object".
apps/lib/obex_object.c:54:2: return_alloc: Returning allocated memory "object".
apps/lib/obex.c:628:2: var_assign: Assigning: "object" = "obex_object_new()".
apps/lib/obex.c:629:2: cond_false: Condition "object == NULL", taking false
 branch
apps/lib/obex.c:630:3: if_end: End of if statement
apps/lib/obex.c:632:2: noescape: Resource "object" is not freed or pointed-to
 in function "obex_object_setcmd(obex_object_t *, uint8_t, uint8_t)".
apps/lib/obex_object.c:113:39: noescape:
 "obex_object_setcmd(obex_object_t *, uint8_t, uint8_t)" does not free or save
 its pointer parameter "object".
apps/lib/obex.c:634:2: cond_true: Condition "cmd == 0", taking true branch
apps/lib/obex.c:635:3: noescape: Resource "object" is not freed or pointed-to
 in function "obex_insert_connectframe(obex_t *, obex_object_t *)".
apps/lib/obex_connect.c:42:59: noescape:
"obex_insert_connectframe(obex_t *, obex_object_t *)" does not free or save its
 pointer parameter "object".
apps/lib/obex.c:635:3: cond_false: Condition
 "obex_insert_connectframe(self, object) < 0", taking false branch
apps/lib/obex.c:638:3: if_end: End of if statement
apps/lib/obex.c:641:2: return_alloc: Returning allocated memory "object".
apps/ircp/ircp_io.c:72:2: var_assign: Assigning:
 "object" = "OBEX_ObjectNew(handle, 2)".
apps/ircp/ircp_io.c:73:2: cond_false: Condition "object == NULL", taking false
 branch
apps/ircp/ircp_io.c:74:3: if_end: End of if statement
apps/ircp/ircp_io.c:78:2: cond_false: Condition "ucname == NULL", taking false
 branch
apps/ircp/ircp_io.c:79:3: if_end: End of if statement
apps/ircp/ircp_io.c:84:2: noescape: Resource "object" is not freed or
 pointed-to in function "OBEX_ObjectAddHeader(obex_t *, obex_object_t *,
 uint8_t, obex_headerdata_t, uint32_t, unsigned int)".
apps/lib/obex.c:713:63: noescape: "OBEX_ObjectAddHeader(obex_t *,
 obex_object_t *, uint8_t, obex_headerdata_t, uint32_t, unsigned int)" does not
 free or save its pointer parameter "object".
apps/ircp/ircp_io.c:88:2: noescape: Resource "object" is not freed or
 pointed-to in function "OBEX_ObjectAddHeader(obex_t *, obex_object_t *,
 uint8_t, obex_headerdata_t, uint32_t, unsigned int)".
apps/lib/obex.c:713:63: noescape: "OBEX_ObjectAddHeader(obex_t *,
 obex_object_t *, uint8_t, obex_headerdata_t, uint32_t, unsigned int)" does not
 free or save its pointer parameter "object".
apps/ircp/ircp_io.c:98:2: noescape: Resource "object" is not freed or
 pointed-to in function "OBEX_ObjectAddHeader(obex_t *, obex_object_t *,
 uint8_t, obex_headerdata_t, uint32_t, unsigned int)".
apps/lib/obex.c:713:63: noescape: "OBEX_ObjectAddHeader(obex_t *,
 obex_object_t *, uint8_t, obex_headerdata_t, uint32_t, unsigned int)" does not
 free or save its pointer parameter "object".
apps/ircp/ircp_io.c:102:2: return_alloc: Returning allocated memory "object".
apps/ircp/ircp_client.c:283: var_assign: Assigning: "object" = storage returned
 from "build_object_from_file(cli->obexhandle, localname, remotename)".
apps/ircp/ircp_client.c:286: cond_true: Condition "cli->fd < 0", taking true
 branch
apps/ircp/ircp_client.c:287: if_fallthrough: Falling through to end of if
 statement
apps/ircp/ircp_client.c:289: if_end: End of if statement
apps/ircp/ircp_client.c:293: cond_true: Condition "ret < 0", taking true branch
apps/ircp/ircp_client.c:294: if_fallthrough: Falling through to end of if
 statement
apps/ircp/ircp_client.c:296: if_end: End of if statement
apps/ircp/ircp_client.c:298: leaked_storage: Variable "object" going out of
 scope leaks the storage it points to.
apps/ircp/ircp_client.c