Index: src/common/sql.c =================================================================== --- src/common/sql.c (revision 11719) +++ src/common/sql.c (working copy) @@ -524,7 +524,7 @@ /// Allocates and initializes a new SqlStmt handle. -SqlStmt* SqlStmt_Malloc(Sql* sql) +SqlStmt* SqlStmt_Malloc_(Sql* sql, const char* file, int line, const char* func) { SqlStmt* self; MYSQL_STMT* stmt; @@ -538,7 +538,11 @@ ShowSQL("DB error - %s\n", mysql_error(&sql->handle)); return NULL; } +#undef ALC_MARK +#define ALC_MARK file, line, func CREATE(self, SqlStmt, 1); +#undef ALC_MARK +#define ALC_MARK __FILE__, __LINE__, __func__ StringBuf_Init(&self->buf); self->stmt = stmt; self->params = NULL; Index: src/common/sql.h =================================================================== --- src/common/sql.h (revision 11719) +++ src/common/sql.h (working copy) @@ -7,6 +7,7 @@ #ifndef _CBASETYPES_H_ #include "../common/cbasetypes.h" #endif +#include "malloc.h" #include // va_list @@ -226,7 +227,8 @@ /// Queries in Sql and SqlStmt are independent and don't affect each other. /// /// @return SqlStmt handle or NULL if an error occured -struct SqlStmt* SqlStmt_Malloc(Sql* sql); +#define SqlStmt_Malloc(sql) SqlStmt_Malloc_(sql, ALC_MARK) +SqlStmt* SqlStmt_Malloc_(Sql* sql, const char* file, int line, const char* func);