Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6868 closed defect (fixed)

hErrorMutex leaks if GDALAllRegister is not called

Reported by: Mateusz Łoskot Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: major Keywords: memory, leak
Cc:

Description

This issue is of similar nature to #6139

Consider this minimal example:

int main()
{
    CPLError(CE_None, CPLE_AppDefined,
             "Expected, CPLError called to trigger hErrorMutex allocation");
    GDALDestroy();
    return 0;
}

If run under memory debugger, hErrorMutex will be reported as memory and kernel resource leak.

The issue is due to:

  • CPLCleanupErrorMutex only called from GDALDriverManager destructor
  • If GDALAllRegister is not called, there is no GDALDriverManager instance to destroy and clean up the mutex

Solution: call CPLCleanupErrorMutex from GDALDestroy to ensure the clean-up

Attachments (2)

gdal-trunk-ticket-6868.patch (1.2 KB ) - added by Mateusz Łoskot 7 years ago.
Fix the reported issue. Update test. (Fixing tab to space)
gdal-trunk-ticket-6868.2.patch (1.2 KB ) - added by Mateusz Łoskot 7 years ago.
Fix the reported issue. Update test.

Download all attachments as: .zip

Change History (6)

by Mateusz Łoskot, 7 years ago

Fix the reported issue. Update test. (Fixing tab to space)

by Mateusz Łoskot, 7 years ago

Fix the reported issue. Update test.

comment:1 by Mateusz Łoskot, 7 years ago

Sorry for dup .patch. They're exactly the same.

comment:2 by Mateusz Łoskot, 7 years ago

Resolution: fixed
Status: newclosed

In 38080:

Fix hErrorMutex leak if GDALAllRegister is not called

Fixes #6868

comment:3 by Mateusz Łoskot, 7 years ago

I'd like to merge it also into branches/2.2, may I?

comment:4 by Mateusz Łoskot, 7 years ago

In 38084:

Merged revision(s) 38080, 38083 from trunk:
Fix hErrorMutex leak if GDALAllRegister is not called

Fixes #6868
........
Untabify r38080
........

Note: See TracTickets for help on using tickets.