Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/makemandb Memory allocated by sqlite3_mprintf shoul...
details: https://anonhg.NetBSD.org/src/rev/bbe94e6aea45
branches: trunk
changeset: 450603:bbe94e6aea45
user: abhinav <abhinav%NetBSD.org@localhost>
date: Fri Apr 19 20:35:13 2019 +0000
description:
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.
diffstat:
usr.sbin/makemandb/apropos-utils.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diffs (40 lines):
diff -r 37a276e921c4 -r bbe94e6aea45 usr.sbin/makemandb/apropos-utils.c
--- a/usr.sbin/makemandb/apropos-utils.c Fri Apr 19 19:46:46 2019 +0000
+++ b/usr.sbin/makemandb/apropos-utils.c Fri Apr 19 20:35:13 2019 +0000
@@ -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.upadhyay%gmail.com@localhost>
* 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 @@
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 @@
}
RETURN:
- free(machine_clause);
- free(section_clause);
- free(limit_clause);
+ sqlite3_free(machine_clause);
+ sqlite3_free(section_clause);
+ sqlite3_free(limit_clause);
return query;
}
Home |
Main Index |
Thread Index |
Old Index