[Plugin] [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded...
#71

Quote:
Originally Posted by Syg
Hi,

Concerning the memory leak, I discovered it myself with the first version of this plugin and corrected it.
That memory leak is a common one, you allocate memory in a function and return the allocated memory. It's up to the caller to free it. It's very easy to forget to free this memory (that cannot be freed in the called function).

And that's exactly what the pcCreateAndFillStringFromCell function does (szDest = new char[nLen+1].
This means that each time you call this function you must call delete on the returned pointer :

Example :
static cell AMX_NATIVE_CALL n_samp_mysql_query( AMX* amx, cell* params )
{
int retval;
const char *query;
query=pcCreateAndFillStringFromCell(amx, params[1]);
retval=mysql_query(&connexion, query); //mysql_query returns 0 if success
delete query; // <--- FREE MEMORY ALLOCATED BY pcCreateAndFillStringFromCell AFTER IT IS USED
if(!retval)
{
return 1;
}
else
{
logprintf("Error in mysql_query: %s",mysql_error(&connexion));
return 0;
}
}

And for the samp_mysql_strtok function uses the pcCreateAndFillStringFromCell function. So it is normal that Bardokas example uses so much memory.

++
Syg
I will please give mefor your pluginof that fix bug
Reply


Messages In This Thread
[REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by ADreNaLiNe-DJ - 16.07.2007, 15:41
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by ADreNaLiNe-DJ - 16.07.2007, 15:51
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by ADreNaLiNe-DJ - 16.07.2007, 16:16
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by d.wine - 16.07.2007, 16:56
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by ADreNaLiNe-DJ - 16.07.2007, 16:58
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by d.wine - 16.07.2007, 18:30
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by Mike - 16.07.2007, 20:21
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by ADreNaLiNe-DJ - 16.07.2007, 20:55
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by Matite - 17.07.2007, 09:08
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by boylett - 17.07.2007, 13:57
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by courage - 17.07.2007, 15:13
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by ADreNaLiNe-DJ - 17.07.2007, 17:47
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by ADreNaLiNe-DJ - 17.07.2007, 17:54
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by boylett - 17.07.2007, 19:18
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by ADreNaLiNe-DJ - 17.07.2007, 19:58
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by boylett - 17.07.2007, 20:53
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by ADreNaLiNe-DJ - 17.07.2007, 20:56
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by boylett - 17.07.2007, 21:02
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by fluid - 17.07.2007, 21:13
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by ADreNaLiNe-DJ - 17.07.2007, 21:56
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by fluid - 17.07.2007, 22:52
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by fluid - 18.07.2007, 06:07
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by fluid - 18.07.2007, 06:30
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by ADreNaLiNe-DJ - 18.07.2007, 08:10
Re: [REL] SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-16-2007) - by fluid - 18.07.2007, 09:12
Re: [REL]SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 18.07.2007, 13:26
Re: [REL]SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-18-2007 => see 1st p - by fluid - 18.07.2007, 15:33
Re: [REL]SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 18.07.2007, 15:55
Re: [REL]SAMP-MySQL and SAMP-MYSQL-lite v0.11 (last edit 07-18-2007 => see 1st p - by fluid - 18.07.2007, 16:42
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 18.07.2007, 18:04
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by courage - 18.07.2007, 18:18
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 18.07.2007, 18:23
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by fluid - 18.07.2007, 18:57
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 18.07.2007, 19:44
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by fluid - 19.07.2007, 00:39
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 19.07.2007, 05:47
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by fluid - 19.07.2007, 07:11
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 19.07.2007, 08:53
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by 50p - 19.07.2007, 11:46
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 19.07.2007, 11:51
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by fluid - 06.09.2007, 20:48
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by visagalis - 07.09.2007, 14:03
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 07.09.2007, 16:00
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by visagalis - 07.09.2007, 18:35
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by kok - 08.09.2007, 09:22
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 08.09.2007, 17:24
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 08.09.2007, 17:29
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by visagalis - 08.09.2007, 19:51
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by Pleite - 14.09.2007, 15:38
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 17.09.2007, 19:26
Problem with Server and the plugin - by Tempo - 23.09.2007, 14:08
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 24.09.2007, 16:18
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by killer57 - 25.09.2007, 22:14
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by fluid - 26.09.2007, 19:31
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by Tony_Columbo - 03.10.2007, 04:28
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 05.10.2007, 15:44
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by thisforumlags - 09.10.2007, 02:28
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by ADreNaLiNe-DJ - 10.10.2007, 22:35
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by TheSh@rk - 25.10.2007, 18:30
Re: [REL]SAMP-MySQL v0.12 (last edit 07-18-2007 => see 1st post) - by IJzerenRita - 25.10.2007, 18:38
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by elmenor25 - 26.12.2008, 01:10
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by asdd - 26.12.2008, 04:10
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by drV - 26.12.2008, 08:25
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by Bardokas - 26.12.2008, 09:26
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by drV - 26.12.2008, 09:53
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by Bardokas - 26.12.2008, 18:06
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by [M2S]moe - 26.12.2008, 18:40
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by Bardokas - 26.12.2008, 18:54
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by drV - 26.12.2008, 21:03
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by drV - 26.12.2008, 21:09
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by chenza - 27.12.2008, 05:25
Please, help me! - by joco96 - 28.12.2008, 12:10
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by Bardokas - 28.12.2008, 12:12
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by joco96 - 28.12.2008, 12:18
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by Bardokas - 28.12.2008, 12:53
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by joco96 - 28.12.2008, 13:39
[REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by [NoV]LaZ - 28.12.2008, 19:00
[REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by joco96 - 29.12.2008, 09:59
Re: [REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by chenza - 30.12.2008, 14:04
[REL]SAMP-MySQL v0.13 - Windows, Ubuntu and CentOs supported !!! - by [NoV]LaZ - 01.01.2009, 02:03
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Dreftas - 02.11.2009, 14:43
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by SoeH - 03.11.2009, 11:52
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by MenaceX^ - 03.11.2009, 12:14
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by SoeH - 03.11.2009, 12:26
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by SE7ENGX - 03.11.2009, 17:41
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Joe Staff - 03.11.2009, 18:11
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by mprofitt - 03.11.2009, 18:32
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Redgie - 04.11.2009, 18:26
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by MenaceX^ - 04.11.2009, 18:55
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Redgie - 04.11.2009, 22:15
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Tirus - 02.04.2010, 10:54
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by MenaceX^ - 02.04.2010, 12:33
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by minimicro - 02.04.2010, 14:07
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Kevinterra - 15.04.2010, 14:07
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Hiddos - 15.04.2010, 19:43
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Victor - 15.04.2010, 19:53
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Sergei - 16.04.2010, 13:14
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Dreftas - 19.04.2010, 11:48
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by chenza - 24.04.2010, 14:40
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Mlody626 - 26.05.2010, 17:31
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Mlody626 - 26.05.2010, 17:31
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Burridge - 26.05.2010, 17:33
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Mlody626 - 26.05.2010, 17:35
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Burridge - 26.05.2010, 17:36
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by nemesis- - 26.05.2010, 20:12
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by StrickenKid - 26.05.2010, 20:42
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by gcw - 21.06.2010, 19:09
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Sergei - 21.06.2010, 19:27
Respuesta: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by DarkChildren - 10.07.2010, 17:05
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Ernis456 - 12.07.2010, 13:53
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Blacklite - 13.07.2010, 21:57
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Sergei - 13.07.2010, 22:12
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by MemoX - 01.08.2010, 00:29
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Septimus314 - 01.08.2010, 19:03
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Cank - 04.08.2010, 20:27
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Cameltoe - 04.08.2010, 21:34
Re: [REL]SAMP-MySQL v0.15 - SAMP 0.3 supported!!! corrected version uploaded... - by Cank - 04.08.2010, 21:43

Forum Jump:


Users browsing this thread: 14 Guest(s)