Forum > FPC development

[SOLVED]cmem.CFreeMemSize possible error

(1/1)

BrunoK:
FPC 3.2.2 and 3.0.4

in \rtl\inc\cmem.pp

It seems to me that :
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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.

Jonas Maebe:
CFreeMem does that dec already (it's a Pascal routine defined in the same unit, not the C library "free").

BrunoK:
Yes sir ! Sorry, my bad.

I didn't notice that it was calling an 'internal' CFreeMem procedure.
 

Navigation

[0] Message Index

Go to full version