NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/51034: makemandb(8): Close database connection when failed to commit



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 31 19:10:00 +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);
 	}
 



Home | Main Index | Thread Index | Old Index