Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
dd71d42a
Commit
dd71d42a
authored
Apr 16, 2013
by
Uwe Schulzweida
Browse files
define_all_vars: Release memory of not freed attributes
parent
0673a350
Changes
1
Show whitespace changes
Inline
Side-by-side
src/stream_cdf.c
View file @
dd71d42a
...
...
@@ -6000,7 +6000,7 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
/* define all input data variables */
static
void
define_all_vars
(
stream_t
*
streamptr
,
int
vlistID
,
int
instID
,
int
modelID
,
int
*
varids
,
int
nvars
,
ncvar_t
*
ncvars
)
void
define_all_vars
(
stream_t
*
streamptr
,
int
vlistID
,
int
instID
,
int
modelID
,
int
*
varids
,
int
nvars
,
int
num_ncvars
,
ncvar_t
*
ncvars
)
{
int
ncid
;
int
varID1
,
varID
,
ncvarid
;
...
...
@@ -6207,9 +6207,14 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
}
free
(
ncvars
[
ncvarid
].
atts
);
ncvars
[
ncvarid
].
atts
=
NULL
;
}
}
/* release mem of not freed attributes */
for
(
ncvarid
=
0
;
ncvarid
<
num_ncvars
;
ncvarid
++
)
if
(
ncvars
[
ncvarid
].
atts
)
free
(
ncvars
[
ncvarid
].
atts
);
if
(
varids
)
free
(
varids
);
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
...
...
@@ -6813,7 +6818,7 @@ int cdfInqContents(stream_t *streamptr)
streamptr
->
ntsteps
=
ntsteps
;
/* define all data variables */
define_all_vars
(
streamptr
,
vlistID
,
instID
,
modelID
,
varids
,
nvars_data
,
ncvars
);
define_all_vars
(
streamptr
,
vlistID
,
instID
,
modelID
,
varids
,
nvars_data
,
nvars
,
ncvars
);
cdiCreateTimesteps
(
streamptr
);
...
...
@@ -6911,10 +6916,10 @@ int cdfInqContents(stream_t *streamptr)
cdfCreateRecords
(
streamptr
,
0
);
/* free ncdims */
free
(
ncdims
);
free
(
ncdims
);
/* free ncvars */
free
(
ncvars
);
free
(
ncvars
);
#endif
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment