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

Coverity output:
apps/obex_test/obex_test_server.c:57: cond_true: Condition
"OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking true
branch
apps/obex_test/obex_test_server.c:58: switch: Switch case
value "1"
apps/obex_test/obex_test_server.c:64: switch_case: Reached
case "1"
apps/obex_test/obex_test_server.c:66: alloc_fn: Storage is
returned from allocation function "malloc(size_t)".
apps/obex_test/obex_test_server.c:66: var_assign: Assigning:
"namebuf" = storage returned from "malloc(hlen / 2U)".
apps/obex_test/obex_test_server.c:66: cond_true: Condition
"namebuf = malloc(hlen / 2)", taking true branch
apps/obex_test/obex_test_server.c:67: 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:68: var_assign: Assigning:
"name" = "namebuf".
apps/obex_test/obex_test_server.c:70: break: Breaking from
switch
apps/obex_test/obex_test_server.c:74: switch_end:
Reached end of switch
apps/obex_test/obex_test_server.c:75: loop: Jumping back
to the beginning of the loop
apps/obex_test/obex_test_server.c:57: loop_begin: Jumped
back to beginning of loop
apps/obex_test/obex_test_server.c:57: cond_false:
Condition "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv,
&hlen)", taking false branch
apps/obex_test/obex_test_server.c:75: loop_end: Reached
end of loop
apps/obex_test/obex_test_server.c:76: cond_true:
Condition "!body", taking true branch
apps/obex_test/obex_test_server.c:78: leaked_storage:
Variable "namebuf" going out of scope leaks the storage it points
to.
apps/obex_test/obex_test_server.c:78: leaked_storage:
Variable "name" going out of scope leaks the storage it points to.
apps/obex_test/obex_test_server.c