Fix: RESOURCE_LEAK (CWE-404)
authorTomas Hozza <thozza@redhat.com>
Sun, 24 Feb 2013 10:38:21 +0000 (11:38 +0100)
committerHendrik Sattler <post@hendrik-sattler.de>
Sun, 24 Feb 2013 10:38:21 +0000 (11:38 +0100)
commit525f4eedde70a6ca95b09823a60ae36deaeb12e3
tree33ee7b0d9adc449901dbed6c3af9fddd692b7ebc
parentc61a4cc585bf66b359ff655889fb3a833477ff68
Fix: RESOURCE_LEAK (CWE-404)

Coverity output:
apps/obex_test/obex_test_server.c:106: cond_true: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking true branch
apps/obex_test/obex_test_server.c:107: switch: Switch case value "1"
apps/obex_test/obex_test_server.c:108: switch_case: Reached case "1"
apps/obex_test/obex_test_server.c:110: alloc_fn: Storage is returned from
 allocation function "malloc(size_t)".
apps/obex_test/obex_test_server.c:110: var_assign: Assigning:
 "namebuf" = storage returned from "malloc(hlen / 2U)".
apps/obex_test/obex_test_server.c:110: cond_true: Condition
 "namebuf = malloc(hlen / 2)", taking true branch
apps/obex_test/obex_test_server.c:111: noescape: Resource "(uint8_t *)namebuf"
 is not freed or pointed-to in function "OBEX_UnicodeToChar(uint8_t *,
 uint8_t const *, int)".
openobex-1.5.0-Source/lib/obex.c:899:41: noescape:
 "OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)" does not free or save
 its pointer parameter "c".
apps/obex_test/obex_test_server.c:112: var_assign: Assigning:
 "name" = "namebuf".
apps/obex_test/obex_test_server.c:114: break: Breaking from switch
apps/obex_test/obex_test_server.c:118: switch_end: Reached end of switch
apps/obex_test/obex_test_server.c:119: loop: Jumping back to the beginning of
 the loop
apps/obex_test/obex_test_server.c:106: loop_begin: Jumped back to beginning of
 loop
apps/obex_test/obex_test_server.c:106: cond_false: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking false
 branch
apps/obex_test/obex_test_server.c:119: loop_end: Reached end of loop
apps/obex_test/obex_test_server.c:121: cond_false: Condition "!name", taking
 false branch
apps/obex_test/obex_test_server.c:125: if_end: End of if statement
apps/obex_test/obex_test_server.c:126: noescape: Resource "name" is not freed
 or pointed-to in function "printf(char const * restrict, ...)".
apps/obex_test/obex_test_server.c:128: noescape: Resource "name" is not freed
 or pointed-to in function "easy_readfile(char const *, int *)".
apps/obex_test/obex_io.c:77:36: noescape: "easy_readfile(char const *, int *)"
 does not free or save its pointer parameter "filename".
apps/obex_test/obex_test_server.c:129: cond_true: Condition "buf == NULL",
 taking true branch
apps/obex_test/obex_test_server.c:130: noescape: Resource "name" is not freed
 or pointed-to in function "printf(char const * restrict, ...)".
apps/obex_test/obex_test_server.c:132: leaked_storage: Variable "namebuf" going
 out of scope leaks the storage it points to.
apps/obex_test/obex_test_server.c:132: leaked_storage: Variable "name" going
 out of scope leaks the storage it points to.

apps/obex_test/obex_test_server.c:106: cond_true: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking true branch
apps/obex_test/obex_test_server.c:107: switch: Switch case value "1"
apps/obex_test/obex_test_server.c:108: switch_case: Reached case "1"
apps/obex_test/obex_test_server.c:110: alloc_fn: Storage is returned from
 allocation function "malloc(size_t)".
apps/obex_test/obex_test_server.c:110: var_assign: Assigning: "namebuf" =
 storage returned from "malloc(hlen / 2U)".
apps/obex_test/obex_test_server.c:110: cond_true: Condition
 "namebuf = malloc(hlen / 2)", taking true branch
apps/obex_test/obex_test_server.c:111: noescape: Resource "(uint8_t *)namebuf"
 is not freed or pointed-to in function "OBEX_UnicodeToChar(uint8_t *,
 uint8_t const *, int)".
openobex-1.5.0-Source/lib/obex.c:899:41: noescape:
 "OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)" does not free or save
 its pointer parameter "c".
apps/obex_test/obex_test_server.c:112: var_assign: Assigning:
 "name" = "namebuf".
apps/obex_test/obex_test_server.c:114: break: Breaking from switch
apps/obex_test/obex_test_server.c:118: switch_end: Reached end of switch
apps/obex_test/obex_test_server.c:119: loop: Jumping back to the beginning of
 the loop
apps/obex_test/obex_test_server.c:106: loop_begin: Jumped back to beginning of
 loop
apps/obex_test/obex_test_server.c:106: cond_false: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking false
 branch
apps/obex_test/obex_test_server.c:119: loop_end: Reached end of loop
apps/obex_test/obex_test_server.c:121: cond_false: Condition "!name", taking
 false branch
apps/obex_test/obex_test_server.c:125: if_end: End of if statement
apps/obex_test/obex_test_server.c:126: noescape: Resource "name" is not freed
 or pointed-to in function "printf(char const * restrict, ...)".
apps/obex_test/obex_test_server.c:128: noescape: Resource "name" is not freed
 or pointed-to in function "easy_readfile(char const *, int *)".
apps/obex_test/obex_io.c:77:36: noescape: "easy_readfile(char const *, int *)"
 does not free or save its pointer parameter "filename".
apps/obex_test/obex_test_server.c:129: cond_false: Condition "buf == NULL",
 taking false branch
apps/obex_test/obex_test_server.c:133: if_end: End of if statement
apps/obex_test/obex_test_server.c:141: leaked_storage: Variable "namebuf" going
 out of scope leaks the storage it points to.
apps/obex_test/obex_test_server.c:141: leaked_storage: Variable "name" going
 out of scope leaks the storage it points to.
apps/obex_test/obex_test_server.c