Construct rpmstrPool with new instead of xcalloc

`rpmstrPool_s` embeds a `std::shared_mutex`, but `rpmstrPoolCreate()` allocates 
it with `xcalloc()`, so the mutex is never constructed. On Linux this works by 
accident (`PTHREAD_MUTEX_INITIALIZER` is all-zero); on macOS/libc++ the zeroed 
`pthread_mutex_t` has an invalid signature, so the first lock fails with 
`EINVAL` and `rpmbuild` aborts while parsing a spec:

    libc++abi: terminating due to uncaught exception of type
    std::__1::system_error: mutex lock failed: Invalid argument

Use `new`/`delete` so the mutex is constructed, matching `rpmkeyring.cc` and 
`macro.cc`. Still reproduces on master.
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/4291

-- Commit Summary --

  * Construct rpmstrPool with new instead of xcalloc

-- File Changes --

    M rpmio/rpmstrpool.cc (4)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/4291.patch
https://github.com/rpm-software-management/rpm/pull/4291.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/4291
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/[email protected]>
_______________________________________________
Rpm-maint mailing list
[email protected]
https://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to