From owner-freebsd-questions Tue May 12 11:15:14 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA22713 for freebsd-questions-outgoing; Tue, 12 May 1998 11:15:14 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from gdi.uoregon.edu (gdi.uoregon.edu [128.223.170.30]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA22704 for ; Tue, 12 May 1998 11:15:07 -0700 (PDT) (envelope-from dwhite@gdi.uoregon.edu) Received: from localhost (dwhite@localhost) by gdi.uoregon.edu (8.8.8/8.8.8) with SMTP id LAA03207; Tue, 12 May 1998 11:14:56 -0700 (PDT) (envelope-from dwhite@gdi.uoregon.edu) Date: Tue, 12 May 1998 11:14:56 -0700 (PDT) From: Doug White Reply-To: Doug White To: Jean-Paul Beconne cc: freebsd-questions@FreeBSD.ORG Subject: Re: Problem with malloc() and free() In-Reply-To: <355848E3.CC8FFC39@nmrc.ucc.ie> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 12 May 1998, Jean-Paul Beconne wrote: > I wrote some code using malloc(), realloc() and free(). When I compiled > it I got an application which has the following problems : > > 1- when free(pointeur) is reach, the application exited and sent the > following error : /usr/libexec/ld.so "AMIC" undefined symbol Please quote the entire error message. > 2- the function printf has a strange behavior : > the code : > printf("something"); > printf("variable %s\n", string); > where string is a pointeur (char) manipulated with malloc() and > realloc() is > working. > And the code : > /* printf("something"); */ > printf("variable %s\n", string); > sends the error "Segmentation fault". Are you initializing string to NULLs? printf is probably running off the end of the variable because it isn't initialized. I'd have to see the entire code. Doug White | University of Oregon Internet: dwhite@resnet.uoregon.edu | Residence Networking Assistant http://gladstone.uoregon.edu/~dwhite | Computer Science Major To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message