C++ 叮当声地址消毒剂检测SDL2泄漏
每当我初始化SDL2例程时,就会出现泄漏。 e、 这是一个简单的代码C++ 叮当声地址消毒剂检测SDL2泄漏,c++,memory-leaks,sdl,sdl-2,clang++,C++,Memory Leaks,Sdl,Sdl 2,Clang++,每当我初始化SDL2例程时,就会出现泄漏。 e、 这是一个简单的代码 #include <iostream> #include <SDL.h> int main() { if (SDL_Init(SDL_INIT_VIDEO) != 0){ std::cerr << "SDL_Init error: " << SDL_GetError() << std::endl; return 1;
#include <iostream>
#include <SDL.h>
int main() {
if (SDL_Init(SDL_INIT_VIDEO) != 0){
std::cerr << "SDL_Init error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Quit();
return 0;
}
为什么我有这些内存泄漏,而gcc没有告诉我任何事情
==11672==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 12 byte(s) in 2 object(s) allocated from:
#0 0x49b1db in malloc (/home/***/build/a.out+0x49b1db)
#1 0x7f979eb12f39 in __GI___strdup (/usr/lib/libc.so.6+0x7ff39)
SUMMARY: AddressSanitizer: 12 byte(s) leaked in 2 allocation(s).