Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/usr.sbin/sushi Pull up revision 1.23 (requested by jaro...
details: https://anonhg.NetBSD.org/src/rev/6c155aadad65
branches: netbsd-1-6
changeset: 528614:6c155aadad65
user: lukem <lukem%NetBSD.org@localhost>
date: Mon Jul 29 14:39:55 2002 +0000
description:
Pull up revision 1.23 (requested by jaromir in ticket #548):
form_appenditem(): make sure fte->list is initialized
process_{pre,}form(): g/c unnecessary malloc, plug memory leak
gen_list(): only check ftp->list after realloc()
handle_{pre,}form(): allocate F[] via calloc(3), so that the memory is
properly zeroed
diffstat:
usr.sbin/sushi/scanform.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diffs (67 lines):
diff -r 64b227495fd8 -r 6c155aadad65 usr.sbin/sushi/scanform.c
--- a/usr.sbin/sushi/scanform.c Mon Jul 29 14:38:48 2002 +0000
+++ b/usr.sbin/sushi/scanform.c Mon Jul 29 14:39:55 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scanform.c,v 1.21.2.1 2002/07/29 14:37:55 lukem Exp $ */
+/* $NetBSD: scanform.c,v 1.21.2.2 2002/07/29 14:39:55 lukem Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -141,6 +141,7 @@
fte->required = req;
fte->elen = 0;
fte->origdata = fte->data;
+ fte->list = NULL;
CIRCLEQ_INIT(&fte->cqSubFormHead);
CIRCLEQ_INSERT_TAIL(cqf, fte, cqFormEntries);
@@ -792,8 +793,7 @@
bailout("malloc: %s", strerror(errno));
fc = lcnt = field_count(form);
args = realloc(args, sizeof(char *) * (lcnt+1));
- f = malloc(sizeof(FIELD *) * lcnt);
- if (f == NULL || args == NULL)
+ if (args == NULL)
bailout("malloc: %s", strerror(errno));
f = form_fields(form);
@@ -896,8 +896,7 @@
fc = lcnt = field_count(form);
args = realloc(args, sizeof(char *) * (lcnt+1+i));
- f = malloc(sizeof(FIELD *) * lcnt);
- if (f == NULL || args == NULL)
+ if (args == NULL)
bailout("malloc: %s", strerror(errno));
f = form_fields(form);
@@ -1044,9 +1043,9 @@
if (i == lmax - 2) {
lmax += 10;
ftp->list = realloc(ftp->list, sizeof(char*) * lmax);
+ if (ftp->list == NULL)
+ bailout("realloc: %s", strerror(errno));
}
- if (ftp->list == NULL)
- bailout("realloc: %s", strerror(errno));
}
ftp->list[i] = NULL;
}
@@ -1590,7 +1589,7 @@
if (scan_form(cqFormHeadp, path))
return(1);
- F = malloc(sizeof(FIELD_RECORD) *
+ F = calloc(sizeof(FIELD_RECORD),
(form_entries(&cqFormHead) * 2 + 1));
if (F == NULL)
bailout("malloc: %s", strerror(errno));
@@ -1691,7 +1690,7 @@
if (scan_form(cqFormHeadp, path))
return(1);
- F = malloc(sizeof(FIELD_RECORD) *
+ F = calloc(sizeof(FIELD_RECORD),
(form_entries(&cqFormHead) * 2 + 1));
if (F == NULL)
bailout("malloc: %s", strerror(errno));
Home |
Main Index |
Thread Index |
Old Index