To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1178
1177  |  1179
Subject: 
Re: memory leak in string handling
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 20 Jun 2000 15:23:32 GMT
Viewed: 
1266 times
  
Torkel Niklasson <torkel.niklasson@telelogic.com> wrote:
If anyone can see any apparant leak, please let me know. Thanks

I don't know of any leaks, but this line includes the terminating \0 in the
output string:

  while(*(d2++) != 0)
    ;

Try the following instead:

while (*d2) d2++;

Presumably if you allocated a buffer of exactly the right size for a
correct strcat, you code would have overflowed that.  Perhaps you'd count
that as a leak.

-Kekoa



Message is in Reply To:
  memory leak in string handling
 
This is not, as far as I know, something that is the matter with legos, but rather with my C programming skills. I'm trying to write the function strcat, but apparantly I'm losing memory somewhere. If anyone can see any apparant leak, please let me (...) (24 years ago, 20-Jun-00, to lugnet.robotics.rcx.legos)

9 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR