Skip to content

Commit 158c790

Browse files
Fix Memory Leak
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).
1 parent e4e2962 commit 158c790

5 files changed

Lines changed: 9 additions & 4 deletions

File tree

dap4_test/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ pingurl4_SOURCES = pingurl4.c
4444
if ENABLE_DAP_REMOTE_TESTS
4545
if BUILD_UTILITIES
4646
# relies on ncdump
47-
TESTS += test_hyrax.sh test_thredds.sh
47+
TESTS += test_hyrax.sh
48+
# TESTS += test_thredds.sh
4849
if AX_IGNORE
4950
TESTS += test_remote.sh
5051
endif

docs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ obsolete/fan_utils.html bestpractices.md filters.md indexing.md
9595
inmemory.md DAP2.dox FAQ.md
9696
known_problems.md
9797
COPYRIGHT.dox user_defined_formats.md DAP4.md DAP4.dox
98-
testserver.dox byterange.dox filters.md nczarr.md auth.md quantize.md)
98+
testserver.dox byterange.md filters.md nczarr.md auth.md quantize.md)
9999

100100
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")

docs/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ windows-binaries.md dispatch.md building-with-cmake.md CMakeLists.txt groups.dox
1313
notes.md install-fortran.md credits.md auth.md filters.md \
1414
obsolete/fan_utils.html indexing.dox inmemory.md FAQ.md \
1515
known_problems.md COPYRIGHT.md inmeminternal.dox testserver.dox \
16-
byterange.dox nczarr.md quantize.md all-error-codes.md
16+
byterange.md nczarr.md quantize.md all-error-codes.md
1717

1818
# Turn off parallel builds in this directory.
1919
.NOTPARALLEL:

libdispatch/dvar.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,9 @@ NC_check_nulls(int ncid, int varid, const size_t *start, size_t **count,
13031303
pointer back to this function, when you're done with the data, and
13041304
it will free the string memory.
13051305
1306+
WARNING: This does not free the data vector itself, only
1307+
the strings to which it points.
1308+
13061309
@param len The number of character arrays in the array.
13071310
@param data The pointer to the data array.
13081311

ncdump/utils.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,8 @@ void nc_get_att_single_string(const int ncid, const int varid,
987987
*str_out = emalloc((att_str_len + 1) * att->tinfo->size);
988988
(*str_out)[att_str_len] = '\0';
989989
strncpy(*str_out, att_strings[0], att_str_len);
990-
nc_free_string(att->len, att_strings);
990+
nc_free_string(att->len, att_strings); /* Warning: does not free att_strings */
991+
free(att_strings);
991992
} else {
992993
fprintf(stderr,"nc_get_att_single_string: unknown attribute type: %d\n", att->type);
993994
fprintf(stderr," must use one of: NC_CHAR, NC_STRING\n");

0 commit comments

Comments
 (0)