minor diff to metalbase module

lance@fox.com
Tue, 6 Sep 94 15:28:30 PDT

This diff fixes a couple minor problems with error reporting and
with memory not being released if there is an error.

===================================================================
RCS file: /u/lance/CVS/python/Extensions/metalbase/metalbasemodule.c,v
retrieving revision 1.2
diff -b -c -r1.2 metalbasemodule.c
*** 1.2 1994/09/02 20:06:03
--- metalbasemodule.c 1994/09/06 21:57:24
***************
*** 948,954 ****
relation *rel_t = RNULL;

if ( !getargs(args,"(ss)", &dir, &rel_name) )
! return err_nomem();
filename = malloc(strlen(dir) + strlen(rel_name) + 10);
if (filename == NULL)
return err_nomem();
--- 948,954 ----
relation *rel_t = RNULL;

if ( !getargs(args,"(ss)", &dir, &rel_name) )
! return NULL;
filename = malloc(strlen(dir) + strlen(rel_name) + 10);
if (filename == NULL)
return err_nomem();
***************
*** 1164,1171 ****
}
count2 = getlistsize((object *)fieldlist);
fieldstr = malloc( (4*count2) + 5);
! if (fieldstr == NULL)
return err_nomem();
fieldstr[0] = '\0';
for (count3 = 0;count3 < count2;count3++) {
int field_num;
--- 1164,1173 ----
}
count2 = getlistsize((object *)fieldlist);
fieldstr = malloc( (4*count2) + 5);
! if (fieldstr == NULL) {
! mb_rmv(rel);
return err_nomem();
+ }
fieldstr[0] = '\0';
for (count3 = 0;count3 < count2;count3++) {
int field_num;
***************
*** 1206,1213 ****
}

filename = malloc(strlen(dir) + strlen(rel_name) + 15);
! if (filename == NULL)
return err_nomem();
sprintf(filename,"%s/%s", dir, rel_name);
if (strcmp(&filename[strlen(filename)-3],".rel"))
strcat(filename,".rel");
--- 1208,1217 ----
}

filename = malloc(strlen(dir) + strlen(rel_name) + 15);
! if (filename == NULL) {
! mb_rmv(rel);
return err_nomem();
+ }
sprintf(filename,"%s/%s", dir, rel_name);
if (strcmp(&filename[strlen(filename)-3],".rel"))
strcat(filename,".rel");

--
Lance Ellinghouse                lance@fox.com