Changeset: 8762f2f5dd6e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8762f2f5dd6e
Modified Files:
tools/mserver/mserver5.c
Branch: default
Log Message:
Defense lines for GDKmalloc failures
diffs (45 lines):
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -339,9 +339,11 @@ main(int argc, char **av)
(optarg[optarglen - 1] == '/' ||
optarg[optarglen - 1] == '\\'))
optarg[--optarglen] = '\0';
- // FIXME unchecked_malloc absolute_path can
return NULL
dbpath = absolute_path(optarg);
- setlen = mo_add_option(&set, setlen,
opt_cmdline, "gdk_dbpath", dbpath);
+ if( dbpath == NULL)
+ fprintf(stderr, "#error: can not
allocate memory for dbpath\n");
+ else
+ setlen = mo_add_option(&set, setlen,
opt_cmdline, "gdk_dbpath", dbpath);
break;
}
if (strcmp(long_options[option_index].name, "dbextra")
== 0) {
@@ -488,16 +490,23 @@ main(int argc, char **av)
if (monet_script) {
monet_script[idx] = NULL;
while (optind < argc) {
- // FIXME unchecked_malloc absolute_path can return NULL
monet_script[idx] = absolute_path(av[optind]);
- monet_script[idx + 1] = NULL;
+ if ( monet_script[idx] == NULL){
+ fprintf(stderr, "!ERROR: cannot allocate memory
for script \n");
+ exit(1);
+ } else {
+ monet_script[idx + 1] = NULL;
+ idx++;
+ }
optind++;
- idx++;
}
}
if (!dbpath) {
- // FIXME unchecked_malloc absolute_path can return NULL
dbpath = absolute_path(mo_find_option(set, setlen,
"gdk_dbpath"));
+ if (dbpath == NULL || GDKcreatedir(dbpath) != GDK_SUCCEED) {
+ fprintf(stderr, "!ERROR: cannot allocate memory for
database directory \n");
+ exit(1);
+ }
}
if (GDKcreatedir(dbpath) != GDK_SUCCEED) {
fprintf(stderr, "!ERROR: cannot create directory for %s\n",
dbpath);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list