Skip to content

Commit

Permalink
Fix Memory Leak
Browse files Browse the repository at this point in the history
re: PR Unidata#2584
re: PR Unidata#2596

Repaired a memory leak in *netcdf-c/ncdump/utils.c*. I think introduced
by PR 2584.

## Misc. Other Changes
* Fixed references to *netcdf-c/docs/byterange.dox* ->  *netcdf-c/docs/byterange.md* (PR 2596).
  • Loading branch information
DennisHeimbigner committed Jan 26, 2023
1 parent e4e2962 commit 158c790
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dap4_test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ pingurl4_SOURCES = pingurl4.c
if ENABLE_DAP_REMOTE_TESTS
if BUILD_UTILITIES
# relies on ncdump
TESTS += test_hyrax.sh test_thredds.sh
TESTS += test_hyrax.sh
# TESTS += test_thredds.sh
if AX_IGNORE
TESTS += test_remote.sh
endif
Expand Down
2 changes: 1 addition & 1 deletion docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ obsolete/fan_utils.html bestpractices.md filters.md indexing.md
inmemory.md DAP2.dox FAQ.md
known_problems.md
COPYRIGHT.dox user_defined_formats.md DAP4.md DAP4.dox
testserver.dox byterange.dox filters.md nczarr.md auth.md quantize.md)
testserver.dox byterange.md filters.md nczarr.md auth.md quantize.md)

ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
2 changes: 1 addition & 1 deletion docs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ windows-binaries.md dispatch.md building-with-cmake.md CMakeLists.txt groups.dox
notes.md install-fortran.md credits.md auth.md filters.md \
obsolete/fan_utils.html indexing.dox inmemory.md FAQ.md \
known_problems.md COPYRIGHT.md inmeminternal.dox testserver.dox \
byterange.dox nczarr.md quantize.md all-error-codes.md
byterange.md nczarr.md quantize.md all-error-codes.md

# Turn off parallel builds in this directory.
.NOTPARALLEL:
Expand Down
3 changes: 3 additions & 0 deletions libdispatch/dvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,9 @@ NC_check_nulls(int ncid, int varid, const size_t *start, size_t **count,
pointer back to this function, when you're done with the data, and
it will free the string memory.
WARNING: This does not free the data vector itself, only
the strings to which it points.
@param len The number of character arrays in the array.
@param data The pointer to the data array.
Expand Down
3 changes: 2 additions & 1 deletion ncdump/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,8 @@ void nc_get_att_single_string(const int ncid, const int varid,
*str_out = emalloc((att_str_len + 1) * att->tinfo->size);
(*str_out)[att_str_len] = '\0';
strncpy(*str_out, att_strings[0], att_str_len);
nc_free_string(att->len, att_strings);
nc_free_string(att->len, att_strings); /* Warning: does not free att_strings */
free(att_strings);
} else {
fprintf(stderr,"nc_get_att_single_string: unknown attribute type: %d\n", att->type);
fprintf(stderr," must use one of: NC_CHAR, NC_STRING\n");
Expand Down

0 comments on commit 158c790

Please sign in to comment.