Module Name: src Committed By: abhinav Date: Fri Apr 19 20:35:14 UTC 2019
Modified Files: src/usr.sbin/makemandb: apropos-utils.c Log Message: Memory allocated by sqlite3_mprintf should be free'd by sqlite3_free This was causing memory corruption thus making apropos(1) fail in some cases. Specifically following options were broken and should be fixed with this commit: -n option was causing a core dump apropos was giving warning when using -l and any of the section numbers as options as reported by paulg on current-users. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/makemandb/apropos-utils.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/makemandb/apropos-utils.c diff -u src/usr.sbin/makemandb/apropos-utils.c:1.42 src/usr.sbin/makemandb/apropos-utils.c:1.43 --- src/usr.sbin/makemandb/apropos-utils.c:1.42 Sun Apr 14 07:59:56 2019 +++ src/usr.sbin/makemandb/apropos-utils.c Fri Apr 19 20:35:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: apropos-utils.c,v 1.42 2019/04/14 07:59:56 abhinav Exp $ */ +/* $NetBSD: apropos-utils.c,v 1.43 2019/04/19 20:35:13 abhinav Exp $ */ /*- * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadh...@gmail.com> * All rights reserved. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: apropos-utils.c,v 1.42 2019/04/14 07:59:56 abhinav Exp $"); +__RCSID("$NetBSD: apropos-utils.c,v 1.43 2019/04/19 20:35:13 abhinav Exp $"); #include <sys/queue.h> #include <sys/stat.h> @@ -580,7 +580,7 @@ generate_search_query(query_args *args, if ((temp = sqlite3_mprintf("%Q%c", args->sections[i], c)) == NULL) goto RETURN; concat(§ion_clause, temp); - free(temp); + sqlite3_free(temp); } } @@ -648,9 +648,9 @@ generate_search_query(query_args *args, } RETURN: - free(machine_clause); - free(section_clause); - free(limit_clause); + sqlite3_free(machine_clause); + sqlite3_free(section_clause); + sqlite3_free(limit_clause); return query; }