From 2e1453cebad36b6175eaf4874593bf8e8b740aa9 Mon Sep 17 00:00:00 2001 From: Geir Hauge Date: Tue, 15 Aug 2006 10:32:42 +0000 Subject: [PATCH] Fikset noen stygge malloc-feil. Fortsatt mange minnelekasjer :/ --- common.c | 6 +++--- mysql-dbadm.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common.c b/common.c index e9bd70f..da14617 100644 --- a/common.c +++ b/common.c @@ -1,5 +1,5 @@ /* - * @(#) $Header: /tmp/cvs/mysql-admutils/common.c,v 1.6 2004-11-18 11:42:41 lkarsten Exp $ + * @(#) $Header: /tmp/cvs/mysql-admutils/common.c,v 1.7 2006-08-15 10:32:42 geirha Exp $ * * functions used by mysql-dbadm.c and mysql-useradm.c * @@ -22,7 +22,7 @@ char *program_name; -static char *rcsheader = "@(#) " PACKAGE " " VERSION " orakel@ntnu.no $Header: /tmp/cvs/mysql-admutils/common.c,v 1.6 2004-11-18 11:42:41 lkarsten Exp $"; +static char *rcsheader = "@(#) " PACKAGE " " VERSION " orakel@ntnu.no $Header: /tmp/cvs/mysql-admutils/common.c,v 1.7 2006-08-15 10:32:42 geirha Exp $"; int @@ -231,7 +231,7 @@ char **get_group_names(int *numgroups) /* Go to next grp if it doesn't have a name */ if (g != NULL) { - grouplist = (char **) realloc(grouplist, (real_nr_groups+1) * sizeof(char *)); + grouplist = (char **) realloc(grouplist, (real_nr_groups+2) * sizeof(char *)); grouplist[real_nr_groups] = strdup(g->gr_name); real_nr_groups++; } else { diff --git a/mysql-dbadm.c b/mysql-dbadm.c index 1efe856..9dddcdf 100644 --- a/mysql-dbadm.c +++ b/mysql-dbadm.c @@ -1,5 +1,5 @@ /* - * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-dbadm.c,v 1.14 2006-07-05 09:00:52 andersmo Exp $ + * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-dbadm.c,v 1.15 2006-08-15 10:32:42 geirha Exp $ * * mysql-dbadm.c * @@ -194,7 +194,7 @@ list(MYSQL *pmysql) escaped_user[strlen(escaped_user)] = cp_kopi[i]; } // for - wild = malloc(strlen(escaped_user)+3); + wild = malloc(strlen(escaped_user)+4); sprintf(wild, "%s\\_%%", escaped_user); #ifdef DEBUG @@ -220,7 +220,7 @@ list(MYSQL *pmysql) cp++; } - wild = malloc(strlen(p->pw_name) + 3); + wild = malloc(strlen(p->pw_name) + 4); sprintf(wild, "%s\\_%%", p->pw_name); #ifdef DEBUG printf("dbadm: wildcard: '%s'\n", wild);