summaryrefslogtreecommitdiffstats
path: root/hl/fortran/src/H5IMfc.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-01-23 04:39:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-01-23 04:39:40 (GMT)
commitfcc03a356b4dd5e58cc88b692b3d05d75b8ae5d0 (patch)
treea18fedef2b670c044913622650ef581dedce7ee1 /hl/fortran/src/H5IMfc.c
parent2c872f398b3824c416d42f2018c3d3ea0c40e80f (diff)
downloadhdf5-fcc03a356b4dd5e58cc88b692b3d05d75b8ae5d0.zip
hdf5-fcc03a356b4dd5e58cc88b692b3d05d75b8ae5d0.tar.gz
hdf5-fcc03a356b4dd5e58cc88b692b3d05d75b8ae5d0.tar.bz2
[svn-r18157] Description:
Bring back changes from Coverity session on 1/15/10: r18111: Fix Coverity issue #130: make certain that the cache gets freed on error. r18112: Fix Coverity issue #43 by making cache testing calls protected by 'pass' variable. r18113: Fix Coverity issue #129 by releasing the cache on error. r18115: Coverity #45 fix: patched an error check in H5Screate_simple to prevent future dereferencing of a NULL point. Added a verification in test/th5s.c. r18116: Fix Coverity issue #43 by releasing cache on error. r18117: Coverity #362,363 by adding HGOTO_DONE, freeing allocations and associated changes. REsolving coverity results #364-368, 369, 370-372, 377, 379, and 380. r18118: Fix Coverity issue #42: assert that cache & test specification pointer are valid. r18122: Coverity #362,363 by adding HGOTO_DONE and freeing allocations. This also takes care of #357,358. r18123: Coverity #359-361, 373-376: Added HGOTO_DONE(FAIL) statement after checking allocation for NULL. Verified allocation is freed in done block. r18128: Fixed coverity issue #10 -- removed dead code. Tested on: Mac OS X/32 10.6.2 (amazon)
Diffstat (limited to 'hl/fortran/src/H5IMfc.c')
-rwxr-xr-xhl/fortran/src/H5IMfc.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c
index bbf98cf..7a54437 100755
--- a/hl/fortran/src/H5IMfc.c
+++ b/hl/fortran/src/H5IMfc.c
@@ -17,7 +17,7 @@
#include "H5IMcc.h"
#include "H5LTf90proto.h"
-
+#include "H5Eprivate.h"
/*-------------------------------------------------------------------------
* Function: h5immake_image_8bit_c
@@ -377,49 +377,30 @@ nh5immake_palette_c (hid_t_f *loc_id,
hsize_t_f *dims,
void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
char *c_name = NULL;
- int c_namelen;
- hsize_t *c_dims;
+ hsize_t c_dims[H5S_MAX_RANK];
int i;
int rank=2;
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
-
- c_dims = malloc(sizeof(hsize_t) * (rank ));
- if (c_dims == NULL)
- goto done;
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (int)*namelen)))
+ HGOTO_DONE(FAIL)
- for (i = 0; i < rank ; i++)
- {
+ for(i = 0; i < rank ; i++)
c_dims[i] = dims[i];
- }
/*
* call H5IMmake_palette function.
*/
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5IMmake_palettef(c_loc_id,c_name,c_dims,buf);
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
+ if(H5IMmake_palettef((hid_t)*loc_id, c_name, c_dims, buf) < 0)
+ HGOTO_DONE(FAIL)
done:
- if(c_name!=NULL)
- free(c_name);
- if(c_dims!=NULL)
- free(c_dims);
+ if(c_name)
+ HDfree(c_name);
return ret_value;
}