From owner-freebsd-hackers Thu Feb 22 7:45:35 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp.nettoll.com (matrix.nettoll.net [212.155.143.61]) by hub.freebsd.org (Postfix) with ESMTP id D222837B4EC for ; Thu, 22 Feb 2001 07:45:28 -0800 (PST) (envelope-from usebsd@free.fr) Received: by smtp.nettoll.com; Thu, 22 Feb 2001 16:43:22 +0100 (MET) Message-Id: <4.3.0.20010222164121.0594c510@pop.free.fr> X-Sender: usebsd@pop.free.fr X-Mailer: QUALCOMM Windows Eudora Version 4.3 Date: Thu, 22 Feb 2001 16:45:42 +0100 To: diwil@eis.ru, freebsd-hackers@FreeBSD.ORG From: mouss Subject: Re: warning in free(): In-Reply-To: References: <20010222051302.E29126@fw.wintelcom.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Now having free() write to stdout/stderr isn't necessarily a good thing for daemons. If the message goes through a socket, it'll be hard to debug, which was the original intent. I suggest having some way so that when a program becomes a daemon, it can set some "silent-libc" or "libc messages go to logs" instead of using stdout/stderr. Wouldn't it not be cool if err() and warn() had the capability of using syslog instead of a file or std* when needed. err_set_file allows one to use a file instead. How about allowing the use of syslog? At 16:16 22/02/01 +0300, Dmitry Dicky wrote: >Also, if you do something like: > > void *ptr = malloc(size); > >... > ptr++; > >free() will complain about it. >Make sure you are not modifying ptr after it has been malloc()ed. > > >On 22-Feb-01 Alfred Perlstein wrote: > > * Madhavi Suram [010222 05:09] wrote: > >> > >> Hi > >> > >> I am running a C program in user space on FreeBSD 3.3 release. I got a > >> warning like this: > >> > >> testing in free(): warning: modified (chunk-) pointer. > >> > >> testing is the name of the executable I am running. > >> > >> Could anyone tell me what this warning means? What may be the effect > >> of > >> this code when I shift it to kernel with due modifications? > > > > It means you've most likely corrupted your malloc pool, meaning you've > > written past/before the edge of an allocation you've done. > > > > To fix it start being mor careful with pointers and checking array > > bounds. > > > > > > -- > > -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-hackers" in the body of the message > >-- >********************************************************************* > ("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ > `6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys > (_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44 > _..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia > (il),-'' (li),' ((!.-' +7 (812) 3148860, 5585314 >********************************************************************* > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-hackers" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message