Open
ummu_mapt_create leaks initialized mutex on failure paths #9
dtwAdd on  May 28
dtw
dtw
May 28 Create

Summary

ummu_mapt_create() allocates mapt_info, initializes mapt_mutex, and then continues with queue/table setup.

Problem

If ummu_queue_create() or the later map initialization path fails, the function jumps to err_queue_create and frees mapt_info directly.

At that point mapt_mutex has already been initialized in ummu_alloc_mapt_mem(), so the error path drops the object without calling pthread_mutex_destroy().

Reproduction

  1. Let ummu_alloc_mapt_mem() succeed.
  2. Make ummu_queue_create() or ummu_mapt_table_ctx_init() fail.
  3. Follow the err_queue_create path in ummu_mapt_create().
  4. Observe that mapt_info is freed while its initialized mutex is still live.

Expected

Failure cleanup should destroy mapt_mutex before freeing mapt_info.

Actual

The initialized mutex is leaked on the create failure path.

likedislike
openeuler-ci-botopeneuler-ci-botCollaborators
May 28 Added label: sig/sig-UnifiedBus
openeuler-ci-bot
openeuler-ci-botCollaborators
May 28 Comments:

Welcome To openEuler Community

Hey @udhdbaa , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: sig-UnifiedBus ,
and any of the maintainers: @hanjunguo, @jerry_lilijun, @liliang_euler, @linyunsheng, @will_niutao ,
and any of the committers: @Tankll2021, @fangfeng123 .

likedislike
dtwdtw
May 28 Associated pull request