NetBSD Problem Report #51034

From www@NetBSD.org  Thu Mar 31 19:08:37 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 048A37A2AD
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 31 Mar 2016 19:08:37 +0000 (UTC)
Message-Id: <20160331190836.180C07A475@mollari.NetBSD.org>
Date: Thu, 31 Mar 2016 19:08:36 +0000 (UTC)
From: er.abhinav.upadhyay@gmail.com
Reply-To: er.abhinav.upadhyay@gmail.com
To: gnats-bugs@NetBSD.org
Subject: makemandb(8): Close database connection when failed to commit
X-Send-Pr-Version: www-1.0

>Number:         51034
>Category:       bin
>Synopsis:       makemandb(8): Close database connection when failed to commit
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 31 19:10:00 +0000 2016
>Closed-Date:    Mon Apr 04 09:43:54 +0000 2016
>Last-Modified:  Wed Apr 13 01:35:01 +0000 2016
>Originator:     Abhinav Upadhyay
>Release:        CURRENT
>Organization:
>Environment:
>Description:
makemandb(8) does not close the connection to the database when it fails to commit the transaction. See the code around line number 478:

/* Commit the transaction */
sqlite3_exec(db, "COMMIT", NULL, NULL, &errmsg);
if (errmsg != NULL) {
	warnx("%s", errmsg);
	free(errmsg);
	exit(EXIT_FAILURE);
}

>How-To-Repeat:

>Fix:
Index: makemandb.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/makemandb/makemandb.c,v
retrieving revision 1.32
diff -u -r1.32 makemandb.c
--- makemandb.c	24 Mar 2016 17:28:03 -0000	1.32
+++ makemandb.c	31 Mar 2016 19:04:19 -0000
@@ -480,6 +480,7 @@
 	if (errmsg != NULL) {
 		warnx("%s", errmsg);
 		free(errmsg);
+		close_db(db);
 		exit(EXIT_FAILURE);
 	}


>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51034 CVS commit: src/usr.sbin/makemandb
Date: Thu, 31 Mar 2016 16:17:58 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Thu Mar 31 20:17:58 UTC 2016

 Modified Files:
 	src/usr.sbin/makemandb: makemandb.c

 Log Message:
 PR/51034: Abhinav Upadhyay: makemandb(8): Close database connection when
 failed to commit


 To generate a diff of this commit:
 cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/makemandb/makemandb.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Mon, 04 Apr 2016 09:43:54 +0000
State-Changed-Why:
Fixed by christos, thanks.


From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51034 CVS commit: src/usr.sbin/makemandb
Date: Tue, 12 Apr 2016 21:32:00 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Wed Apr 13 01:32:00 UTC 2016

 Modified Files:
 	src/usr.sbin/makemandb: makemandb.c

 Log Message:
 PR/51034: Abhinav Upadhyay: Close database connection when failed to commit


 To generate a diff of this commit:
 cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/makemandb/makemandb.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.