1

我有一段简单的代码可以创建 MySQL 连接:

MYSQL *conn = mysql_init(NULL);
if(conn == NULL){
    fprintf(stderr, "Error: can't create MySQL-descriptor\n");
    exit(1);
}

if(!mysql_real_connect(conn,"my_host.com","my_server","psw",NULL,NULL,NULL,0)){
    fprintf(stderr, "Error: can't connect to database %s\n", mysql_error(conn));
} else {
    fprintf(stdout, "MySQL connect Success!\n");
} 
mysql_close(conn);

valgrind 说:

==3283== LEAK SUMMARY:
==3283==    definitely lost: 0 bytes in 0 blocks
==3283==    indirectly lost: 0 bytes in 0 blocks
==3283==    possibly lost: 0 bytes in 0 blocks
==3283==    still reachable: 61,512 bytes in 17 blocks
==3283==    suppressed: 0 bytes in 0 blocks

这是一个实际的内存泄漏?

4

0 回答 0