[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Realloc



On 27 Feb, Mogens Kjaer wrote:
 Kan det være fordi du refererer til Ptr og ikke Ptr2 efter realloc?

Om jag skriver det lite tydligare:

out("Before %s %d\n", Ptr, ll);
Ptr2 = (char *) realloc(Ptr, ll);
out("After\n");

if(Ptr2 == NULL){
    error handling
} else {
    Ptr = Ptr2;
}

out() är en funktion som är likvärdig till vfprintf/printf och den fungerar (== välbeprövad).

Första out() raden kommer fram, och därför vet jag att Ptr och ll har rimliga värden. Men den andra out satsen "After" kommer inte fram. Det är därför som jag antar att det är på den raden som vi krashar på.

Det är inte första gången jag utökar bufferten som vi krashar. Jag hara redan gjort det några gånger innan det sker. Därför tycker jag att det är väldigt märkligt.

mvh
  Martin Bertilsson Haagen
-----------------------------------------
 sslug@sslug (+46) 707 671717
 http://www.unixuser.nu
-----------------------------------------




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *