https://bugs.kde.org/show_bug.cgi?id=419132
Bug ID: 419132 Summary: potential memory leakage: forget using libxml2 API 'xmlXPathFreeContext‘ after 'xmlXPathNewContext' Product: amarok Version: unspecified Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: Tools/Statistics Synchronization Assignee: amarok-bugs-d...@kde.org Reporter: summerlinas...@gmail.com Target Milestone: kf5 SUMMARY I found this issue when reading source code in the file 'src/services/mp3tunes/libmp3tunes/locker.c'. STEPS TO REPRODUCE 1. first, there are 2 functions using libxml2 API: the defined xml_xpath_init() in 84 line uses API 'xmlXPathNewContext', the defined xml_xpath_deinit() in 119 line uses API 'xmlXPathFreeContext'. 2. the second usage of xml_xpath_init() in this c file lies in 422 line, inside the defined function mp3tunes_locker_api_post_fetch() 3. then mp3tunes_locker_api_post_fetch() is used in line 1391. After it, xml_xpath_deinit() is not called to free 'result->xpath_ctx' while free() is used directly to free 'result'. So the unfree 'result->xpath_ctx' memory is leaked. OBSERVED RESULT EXPECTED RESULT SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: (available in About System) KDE Plasma Version: KDE Frameworks Version: Qt Version: ADDITIONAL INFORMATION -- You are receiving this mail because: You are watching all bug changes.