From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from qmta04.westchester.pa.mail.comcast.net (qmta04.westchester.pa.mail.comcast.net [IPv6:2001:558:fe14:43:76:96:62:40]) by hurricane.the-brannons.com (Postfix) with ESMTP id 605BF77AD6 for ; Tue, 24 Dec 2013 10:44:09 -0800 (PST) Received: from omta10.westchester.pa.mail.comcast.net ([76.96.62.28]) by qmta04.westchester.pa.mail.comcast.net with comcast id 5WJY1n0020cZkys54Wk4z4; Tue, 24 Dec 2013 18:44:04 +0000 Received: from eklhad ([107.5.36.150]) by omta10.westchester.pa.mail.comcast.net with comcast id 5Wk41n00F3EMmQj3WWk4Fb; Tue, 24 Dec 2013 18:44:04 +0000 To: Edbrowse-dev@lists.the-brannons.com From: Karl Dahlke User-Agent: edbrowse/3.4.10 Date: Tue, 24 Dec 2013 13:44:03 -0500 Message-ID: <20131124134403.eklhad@comcast.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1387910644; bh=u306ZoK1VtbVQVd+Lo3H6Inv45X5sWEY0dDr5ytRLzg=; h=Received:Received:To:From:Reply-to:Subject:Date:Message-ID: Mime-Version:Content-Type; b=bXZQeDOWg8wQCLMLIiGsH1m0hrNgb8uQBqOnjQhblLfzf4LtAQa0fKbnfvGRWTgur +OtEIh3sJT/PfQtX2f19ctA8qCz2zLBc6H8HiKsSmWxK3jEjF/qYkAV5pv65tWheii 2yRXbhof+uw+ISSujPbtDtvBU/PlZ68lwJ/ZWoGmPWxhIPvtAtSQCg8F6cwMWlaTPH 7heQwncUmaTbafX28PTEZPTu9MmgCOLkETE5/EPrT4pleOhrveVuEBJEZ20C5cPddi 1jKEBGlv2xQSVOfb2Cx+K2EFUz8Yf6w3cE/+5pBlEY8WxLHdomFY6WKqTcmJ37W0w0 vn7TEceo2l1bg== Subject: [Edbrowse-dev] JS_smprintf X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Karl Dahlke List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2013 18:44:09 -0000 It looks like JS_smprintf is a version of sprint that allocates a string long enough to hold the expanded message, so you don't have to worry about a big enough char buffer, like you do with sprintf. All good, but it's allocated, and so has to be freed. Then js had its own heap within itself, that may or may not be known to malloc, so I had to call JS_free(cx, string); I don't think you can just call free. There's a lot of this in my_errorReporter(). Then I read somewhere that I was suppose to use explicitly JS_smprintf_free to free up these sprintf lines. So I guess I used that in jsloc.c, but never in jsdom.c Inconsistent, and yet it all seems to work. I probably could have used js_free everywhere. I don't even know if we need to do this at all, any more, or if the c++ version has a better garbage collector. Probably we still have to do it, because the gc would have no idea when we were done with those strings, as allocated by js_sprintf. That's the history of it as best I can paste together from my memory and fromlooking at the code. Karl Dahlke