diff options
Diffstat (limited to 'hl/test/test_lite.c')
-rw-r--r-- | hl/test/test_lite.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index ad12fb2..9234344 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1535,17 +1535,16 @@ static int test_complicated_compound(void) hid_t dtype; int nmembs; H5T_class_t type_class; - char* line=NULL; - FILE *fp; + char *line = NULL; + FILE *fp = NULL; size_t size = 1024; - char *srcdir = getenv("srcdir"); /* the source directory */ + char *srcdir = getenv("srcdir"); /* the source directory */ char filename[1024]=""; TESTING3(" text for complicated compound types"); /* compose the name of the file to open, using the srcdir, if appropriate */ - if(srcdir) - { + if(srcdir) { strcpy(filename, srcdir); strcat(filename, "/"); } @@ -1553,8 +1552,7 @@ static int test_complicated_compound(void) /* Open input file */ fp = fopen(filename, "r"); - if(fp == NULL) - { + if(fp == NULL) { printf( "Could not find file %s. Try set $srcdir \n", filename); goto out; } @@ -1580,6 +1578,7 @@ static int test_complicated_compound(void) } fclose(fp); + fp = NULL; if((dtype = H5LTtext_to_dtype(line, H5LT_DDL))<0) goto out; @@ -1602,6 +1601,12 @@ static int test_complicated_compound(void) return 0; out: + + if(line) + free(line); + if(fp) + fclose(fp); + H5_FAILED(); return -1; } |