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
Vector graphics floodfill...
by
zamtmn
[
Today
at 08:07:55 pm]
Regex conversion escapes
by
MarkMLl
[
Today
at 07:52:11 pm]
binding DOM elements in D...
by
nomorelogic
[
Today
at 07:04:18 pm]
Lazarus Release 2.2.2
by
folkeu08
[
Today
at 07:01:24 pm]
installation warning
by
systems
[
Today
at 06:59:05 pm]
sqlite + spellfix
by
Espectr0
[
Today
at 06:23:33 pm]
HTML to text
by
pcurtis
[
Today
at 06:12:33 pm]
How do I add a Pascal com...
by
rvk
[
Today
at 05:40:11 pm]
Using FV's TListBox, Memo...
by
Mathias
[
Today
at 05:30:06 pm]
How do I access the full ...
by
rvk
[
Today
at 05:21:57 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED]cmem.CFreeMemSize possible error (Read 671 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