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
Black background on objec...
by
Thaddy
[
Today
at 06:12:39 pm]
Question about RPI_HAL CP...
by
Thaddy
[
Today
at 04:52:59 pm]
Debugging libraries
by
Thaddy
[
Today
at 04:32:44 pm]
Feature announcement: Fun...
by
Thaddy
[
Today
at 03:12:27 pm]
RP2040 with Picoprobe and...
by
MarkMLl
[
Today
at 01:03:07 pm]
Problem saving new projec...
by
wp
[
Today
at 12:50:46 pm]
resize Form when enable o...
by
Thaddy
[
Today
at 10:15:03 am]
Daemon application: -r/--...
by
Nimral
[
Today
at 09:05:10 am]
Simple animation with TTi...
by
Handoko
[
Today
at 05:25:48 am]
how do I use TCharacter (...
by
Weiss
[
Today
at 02:45:37 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED]cmem.CFreeMemSize possible error (Read 676 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