Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Coverity RESOURCE_LEAK error in acl_profiler_test.cpp #274

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

IlanTruanovsky
Copy link
Contributor

Coverity picked up a RESOURCE_LEAK error that was not fixed in #267

Fixes:

test/acl_profiler_test.cpp:812:3:
  Type: Resource leak (RESOURCE_LEAK)

test/acl_profiler_test.cpp:756:3:
  1. path: Condition "MtUtest::threadNum() == 0", taking true branch.
test/acl_profiler_test.cpp:758:5:
  2. path: Condition "0 != status", taking true branch.
test/acl_profiler_test.cpp:758:5:
  3. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:763:5:
  4. path: Condition "0 != status", taking true branch.
test/acl_profiler_test.cpp:763:5:
  5. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:765:5:
  6. path: Condition "0 != clSetKernelArg(kernel, 0, 8UL /* sizeof (cl_mem) */, &src_mem)", taking true branch.
test/acl_profiler_test.cpp:765:5:
  7. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:767:5:
  8. path: Condition "0 != clSetKernelArg(kernel, 1, 8UL /* sizeof (cl_mem) */, &src_mem)", taking true branch.
test/acl_profiler_test.cpp:767:5:
  9. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:769:5:
  10. path: Condition "0 != clSetKernelArg(kernel, 2, 8UL /* sizeof (cl_mem) */, &src_mem)", taking true branch.
test/acl_profiler_test.cpp:769:5:
  11. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:777:5:
  12. path: Condition "0 != status", taking true branch.
test/acl_profiler_test.cpp:777:5:
  13. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:784:3:
  14. path: Condition "MtUtest::threadNum() == 0", taking true branch.
test/acl_profiler_test.cpp:786:5:
  15. path: Condition "active_op", taking true branch.
test/acl_profiler_test.cpp:786:5:
  16. path: Condition "!Utest::getCurrent()->assertTrue(active_op, "active_op", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_profiler_test.cpp", 786)", taking true branch.
test/acl_profiler_test.cpp:787:5:
  17. path: Condition "ACL_DEVICE_OP_KERNEL != active_op->info.type", taking true branch.
test/acl_profiler_test.cpp:787:5:
  18. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:796:3:
  19. path: Condition "MtUtest::threadNum() == 0", taking true branch.
test/acl_profiler_test.cpp:797:5:
  20. alloc_fn: Storage is returned from allocation function "fopen".
test/acl_profiler_test.cpp:797:5:
  21. var_assign: Assigning: "fp" = storage returned from "fopen("profile.mon", "r")".
test/acl_profiler_test.cpp:798:5:
  22. path: Condition "fp == NULL", taking false branch.
test/acl_profiler_test.cpp:798:5:
  23. path: Condition "!Utest::getCurrent()->assertTrue(fp == NULL, "fp == NULL", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_profiler_test.cpp", 798)", taking true branch.
test/acl_profiler_test.cpp:805:5:
  24. path: Condition "acl_process_profiler_scan_chain(event->current_device_op)", taking true branch.
test/acl_profiler_test.cpp:805:5:
  25. path: Condition "!Utest::getCurrent()->assertTrue(acl_process_profiler_scan_chain(event->current_device_op), "acl_process_profiler_scan_chain(event->current_device_op)", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_profiler_test.cpp", 806)", taking true branch.
test/acl_profiler_test.cpp:807:5:
  26. path: Condition "acl_process_autorun_profiler_scan_chain(0, 0)", taking true branch.
test/acl_profiler_test.cpp:807:5:
  27. path: Condition "!Utest::getCurrent()->assertTrue(acl_process_autorun_profiler_scan_chain(0, 0), "acl_process_autorun_profiler_scan_chain(0, 0)", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_profiler_test.cpp", 807)", taking true branch.
test/acl_profiler_test.cpp:812:3:
  28. leaked_storage: Variable "fp" going out of scope leaks the storage it points to.

@IlanTruanovsky IlanTruanovsky self-assigned this Feb 6, 2023
@IlanTruanovsky IlanTruanovsky added the bug Something isn't working label Feb 6, 2023
@IlanTruanovsky IlanTruanovsky added this to the 2023.2 milestone Feb 6, 2023
@IlanTruanovsky IlanTruanovsky changed the title Fix RESOURCE_LEAK error in acl_profiler_test.cpp Fix Coverity RESOURCE_LEAK error in acl_profiler_test.cpp Feb 6, 2023
Coverity picked up a `RESOURCE_LEAK` error that was not fixed in intel#267

Fixes:
```
test/acl_profiler_test.cpp:812:3:
  Type: Resource leak (RESOURCE_LEAK)

test/acl_profiler_test.cpp:756:3:
  1. path: Condition "MtUtest::threadNum() == 0", taking true branch.
test/acl_profiler_test.cpp:758:5:
  2. path: Condition "0 != status", taking true branch.
test/acl_profiler_test.cpp:758:5:
  3. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:763:5:
  4. path: Condition "0 != status", taking true branch.
test/acl_profiler_test.cpp:763:5:
  5. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:765:5:
  6. path: Condition "0 != clSetKernelArg(kernel, 0, 8UL /* sizeof (cl_mem) */, &src_mem)", taking true branch.
test/acl_profiler_test.cpp:765:5:
  7. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:767:5:
  8. path: Condition "0 != clSetKernelArg(kernel, 1, 8UL /* sizeof (cl_mem) */, &src_mem)", taking true branch.
test/acl_profiler_test.cpp:767:5:
  9. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:769:5:
  10. path: Condition "0 != clSetKernelArg(kernel, 2, 8UL /* sizeof (cl_mem) */, &src_mem)", taking true branch.
test/acl_profiler_test.cpp:769:5:
  11. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:777:5:
  12. path: Condition "0 != status", taking true branch.
test/acl_profiler_test.cpp:777:5:
  13. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:784:3:
  14. path: Condition "MtUtest::threadNum() == 0", taking true branch.
test/acl_profiler_test.cpp:786:5:
  15. path: Condition "active_op", taking true branch.
test/acl_profiler_test.cpp:786:5:
  16. path: Condition "!Utest::getCurrent()->assertTrue(active_op, "active_op", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_profiler_test.cpp", 786)", taking true branch.
test/acl_profiler_test.cpp:787:5:
  17. path: Condition "ACL_DEVICE_OP_KERNEL != active_op->info.type", taking true branch.
test/acl_profiler_test.cpp:787:5:
  18. path: Falling through to end of if statement.
test/acl_profiler_test.cpp:796:3:
  19. path: Condition "MtUtest::threadNum() == 0", taking true branch.
test/acl_profiler_test.cpp:797:5:
  20. alloc_fn: Storage is returned from allocation function "fopen".
test/acl_profiler_test.cpp:797:5:
  21. var_assign: Assigning: "fp" = storage returned from "fopen("profile.mon", "r")".
test/acl_profiler_test.cpp:798:5:
  22. path: Condition "fp == NULL", taking false branch.
test/acl_profiler_test.cpp:798:5:
  23. path: Condition "!Utest::getCurrent()->assertTrue(fp == NULL, "fp == NULL", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_profiler_test.cpp", 798)", taking true branch.
test/acl_profiler_test.cpp:805:5:
  24. path: Condition "acl_process_profiler_scan_chain(event->current_device_op)", taking true branch.
test/acl_profiler_test.cpp:805:5:
  25. path: Condition "!Utest::getCurrent()->assertTrue(acl_process_profiler_scan_chain(event->current_device_op), "acl_process_profiler_scan_chain(event->current_device_op)", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_profiler_test.cpp", 806)", taking true branch.
test/acl_profiler_test.cpp:807:5:
  26. path: Condition "acl_process_autorun_profiler_scan_chain(0, 0)", taking true branch.
test/acl_profiler_test.cpp:807:5:
  27. path: Condition "!Utest::getCurrent()->assertTrue(acl_process_autorun_profiler_scan_chain(0, 0), "acl_process_autorun_profiler_scan_chain(0, 0)", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_profiler_test.cpp", 807)", taking true branch.
test/acl_profiler_test.cpp:812:3:
  28. leaked_storage: Variable "fp" going out of scope leaks the storage it points to.
```
@pcolberg pcolberg merged commit 03ebe32 into intel:main Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants