From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.bugs Subject: [bug #34023] Memory leak in i18n.c Date: Tue, 16 Aug 2011 10:36:52 +0000 Message-ID: <20110816-103651.sv78157.79991@savannah.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=UTF-8 X-Trace: dough.gmane.org 1313490903 29335 80.91.229.12 (16 Aug 2011 10:35:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 16 Aug 2011 10:35:03 +0000 (UTC) To: Stefan Israelsson Tampe , bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Aug 16 12:34:58 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QtGz2-0003p1-RB for guile-bugs@m.gmane.org; Tue, 16 Aug 2011 12:34:56 +0200 Original-Received: from localhost ([::1]:43783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtGz2-0006Kq-Ab for guile-bugs@m.gmane.org; Tue, 16 Aug 2011 06:34:56 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtGyz-0006Kk-8F for bug-guile@gnu.org; Tue, 16 Aug 2011 06:34:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QtGyy-00013g-93 for bug-guile@gnu.org; Tue, 16 Aug 2011 06:34:53 -0400 Original-Received: from savannah.gnu.org ([140.186.70.70]:57495 helo=frontend.savannah.gnu.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtGyx-00013b-T3 for bug-guile@gnu.org; Tue, 16 Aug 2011 06:34:52 -0400 Original-Received: from www-data by frontend.savannah.gnu.org with local (Exim 4.72) (envelope-from ) id 1QtH0u-0001B5-EX; Tue, 16 Aug 2011 10:36:52 +0000 X-PHP-Originating-Script: 0:sendmail.php X-Savane-Server: savannah.gnu.org:443 [140.186.70.70] X-Savane-Project: guile X-Savane-Tracker: bugs X-Savane-Item-ID: 34023 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101216 Linux Mint/1 (Debian) Firefox/3.6.13 X-Apparently-From: 82.182.254.46 (Savane authenticated user tampe) Original-References: In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.70 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5773 Archived-At: URL: Summary: Memory leak in i18n.c Project: Guile Submitted by: tampe Submitted on: Tue 16 Aug 2011 10:36:51 AM GMT Category: None Severity: 3 - Normal Item Group: None Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any _______________________________________________________ Details: This looks strange: Consider this in i18.c, get_current_locale (SCM *result) { int err = 0; scm_t_locale c_locale; const char *current_locale; (1) c_locale = scm_gc_malloc (sizeof (* c_locale), "locale"); lock_locale_mutex (); c_locale->category_mask = LC_ALL_MASK; c_locale->base_locale = SCM_UNDEFINED; current_locale = setlocale (LC_ALL, NULL); if (current_locale != NULL) { (2) c_locale->locale_name = strdup (current_locale); if (c_locale->locale_name == NULL) err = ENOMEM; } else err = EINVAL; unlock_locale_mutex (); if (err) scm_gc_free (c_locale, sizeof (* c_locale), "locale"); else SCM_NEWSMOB (*result, scm_tc16_locale_smob_type, c_locale); return err; } (1) c_locale is allocated managed by gc and not pointerless. e.g. members should as well be gc allocated (2) a memeber of c_locale is setted to a malloced memory region should it be scm_strdup? /Stefan _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/