Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
FPC development
(Moderators:
FPK
,
Tomas Hajny
) »
[SOLVED]cmem.CFreeMemSize possible error
Free Pascal
Website
Downloads
Wiki
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Simple animation with TTi...
by
heebiejeebies
[
Today
at 03:10:26 am]
how do I use TCharacter (...
by
Weiss
[
Today
at 02:45:37 am]
MOVED: Question about RPI...
by
trev
[
Today
at 02:19:29 am]
Vector graphics floodfill...
by
ADMGNS
[
Today
at 01:42:05 am]
BGRA Controls
by
lainz
[May 27, 2022, 10:48:49 pm]
Feature announcement: Fun...
by
Thaddy
[May 27, 2022, 09:32:11 pm]
resize Form when enable o...
by
eldonfsr
[May 27, 2022, 08:35:47 pm]
[SOLVED] Illegal type con...
by
Thaddy
[May 27, 2022, 05:48:33 pm]
Lazarus Release 2.2.2
by
Milsa
[May 27, 2022, 04:24:37 pm]
Question about RPI_HAL CP...
by
pascalbythree
[May 27, 2022, 04:01:15 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED]cmem.CFreeMemSize possible error (Read 675 times)
BrunoK
Sr. Member
Posts: 291
Retired programmer
[SOLVED]cmem.CFreeMemSize possible error
«
on:
January 13, 2022, 07:23:25 pm »
FPC 3.2.2 and 3.0.4
in \rtl\inc\cmem.pp
It seems to me that :
Code: Pascal
[Select]
[+]
[-]
Function
CFreeMemSize
(
p
:
pointer
;
Size
:
ptruint
)
:
ptruint
;
begin
if
size<
=
0
then
exit
;
if
(
p <>
nil
)
then
begin
if
(
size <> Pptruint
(
p
-
sizeof
(
ptruint
)
)
^
)
then
runerror
(
204
)
;
end
;
CFreeMemSize
:
=
CFreeMem
(
P
)
;
end
;
should be
Code: Pascal
[Select]
[+]
[-]
Function
CFreeMemSize
(
p
:
pointer
;
Size
:
ptruint
)
:
ptruint
;
begin
if
size<
=
0
then
exit
;
if
(
p <>
nil
)
then
begin
if
(
size <> Pptruint
(
p
-
sizeof
(
ptruint
)
)
^
)
then
runerror
(
204
)
;
dec
(
p
,
sizeof
(
ptruint
)
)
;
// <<<<------ here
end
;
CFreeMemSize
:
=
CFreeMem
(
P
)
;
end
;
The dec(p,sizeof(ptruint)); seems to be missing to get the pointer to pass to cmem CFreeMem library function.
What do you think ?
It seems to have no consequence because it is apparently never called by fpc or lazarus but it looks anyway like a possible bug.
«
Last Edit: January 13, 2022, 07:31:52 pm by BrunoK
»
Logged
Jonas Maebe
Hero Member
Posts: 963
Re: cmem.CFreeMemSize possible error
«
Reply #1 on:
January 13, 2022, 07:25:25 pm »
CFreeMem does that dec already (it's a Pascal routine defined in the same unit, not the C library "free").
Logged
BrunoK
Sr. Member
Posts: 291
Retired programmer
Re: cmem.CFreeMemSize possible error
«
Reply #2 on:
January 13, 2022, 07:30:30 pm »
Yes sir ! Sorry, my bad.
I didn't notice that it was calling an 'internal' CFreeMem procedure.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
FPC development
(Moderators:
FPK
,
Tomas Hajny
) »
[SOLVED]cmem.CFreeMemSize possible error
TinyPortal
© 2005-2018