Changeset: 4200e90e1bdc for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4200e90e1bdc Modified Files: clients/mapiclient/mclient.c Branch: Aug2011 Log Message:
mclient: do not use alloca Use malloc and free for variable sized allocations. diffs (41 lines): diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -399,7 +399,7 @@ char *t; int rows = 0; /* return number of output lines printed */ size_t ulen; - int *cutafter = alloca(sizeof(int) * fields); + int *cutafter = malloc(sizeof(int) * fields); /* trim the text if needed */ if (trim == 1) { @@ -528,6 +528,8 @@ first = 0; rows++; } while (more); + + free(cutafter); return rows; } @@ -966,8 +968,8 @@ SQLseparator(len, fields, '-'); if (mapi_get_name(hdl, 0)) { int i; - char **names = (char **) alloca(fields * sizeof(char *)); - int *numeric = (int *) alloca(fields * sizeof(int)); + char **names = (char **) malloc(fields * sizeof(char *)); + int *numeric = (int *) malloc(fields * sizeof(int)); for (i = 0; i < fields; i++) { names[i] = mapi_get_name(hdl, i); @@ -975,6 +977,8 @@ } SQLrow(len, numeric, names, fields, 1, more); SQLseparator(len, fields, '='); + free(names); + free(numeric); } } _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list