Fikset noen stygge malloc-feil. Fortsatt mange minnelekasjer :/

This commit is contained in:
Geir Hauge 2006-08-15 10:32:42 +00:00
parent 2191acfd78
commit 2e1453ceba
2 changed files with 6 additions and 6 deletions

View File

@ -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 {

View File

@ -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);