This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Christian, > I just migrated my code from udunits 1.12.9 to udunits 2.1.23, and I have > the following errors coming from valgrind in the execution of my code. These > seems to be internal errors of udunits?! Any hints or comments? > > Thanks! > > Best regards, > > Christian > > ==31403== at 0x4C1B578: compare (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x34F64D1C31: tdelete (in /lib64/libc-2.5.so) > ==31403== by 0x4C1B689: freeIfAllocated (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1B6EB: setUnit (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x42E851: change_date_origin (change_date_origin.c:82) > ==31403== by 0x417288: read_large_scale_fields > (read_large_scale_fields.c:222) > ==31403== by 0x4257FA: wt_downscaling (wt_downscaling.c:115) > ==31403== by 0x403915: main (dsclim.c:191) It should be safe to ignore the above because the probability of freeing the wrong object is about 2^64 to 1 against. > ==31403== > ==31403== Conditional jump or move depends on uninitialised value(s) > ==31403== at 0x34F64D1C3B: tdelete (in /lib64/libc-2.5.so) > ==31403== by 0x4C1B689: freeIfAllocated (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1B6EB: setUnit (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x42E851: change_date_origin (change_date_origin.c:82) > ==31403== by 0x417288: read_large_scale_fields > (read_large_scale_fields.c:222) > ==31403== by 0x4257FA: wt_downscaling (wt_downscaling.c:115) > ==31403== by 0x403915: main (dsclim.c:191) Same with this one. > ==31403== > ==31403== Use of uninitialised value of size 8 > ==31403== at 0x34F64D1C18: tdelete (in /lib64/libc-2.5.so) > ==31403== by 0x4C1B689: freeIfAllocated (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1B6EB: setUnit (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x42E851: change_date_origin (change_date_origin.c:82) > ==31403== by 0x417288: read_large_scale_fields > (read_large_scale_fields.c:222) > ==31403== by 0x4257FA: wt_downscaling (wt_downscaling.c:115) > ==31403== by 0x403915: main (dsclim.c:191) Same. > ==31403== > ==31403== Invalid read of size 8 > ==31403== at 0x4C0F7E3: ut_free (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x42D192: make_udu_origin_zero (utCalendar2_cal.c:173) > ==31403== by 0x42E47C: utCalendar2_cal (utCalendar2_cal.c:225) > ==31403== by 0x43D1C3: compute_time_info (compute_time_info.c:111) > ==31403== by 0x416F92: read_large_scale_fields > (read_large_scale_fields.c:226) > ==31403== by 0x4257FA: wt_downscaling (wt_downscaling.c:115) > ==31403== by 0x403915: main (dsclim.c:191) It looks like function make_udu_origin_zero() is freeing an unallocated unit. This is outside the scope of the UDUNTIS-2 package. > ==31403== Address 0x75969a8 is 8 bytes inside a block of size 88 free'd > ==31403== at 0x4A05A31: free (vg_replace_malloc.c:325) > ==31403== by 0x34F9C04D06: XML_ParserFree (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x4C1922E: readXml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1B3C6: endElement (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x34F9C09E84: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0AB43: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0B96C: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0CC2A: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C03EF0: XML_ParseBuffer (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x4C193B6: readXml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C194F2: ut_read_xml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1BEC2: utInit (in > /data/local64/lib/libudunits2.so.0.1.0) The expat XML library does have some valgrind(1) problems. I don't know if they're serious or not. > ==31403== > ==31403== Invalid read of size 8 > ==31403== at 0x4C10D83: productFree (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C10DB1: basicFree (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C105B3: timestampFree (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x42D192: make_udu_origin_zero (utCalendar2_cal.c:173) > ==31403== by 0x42E47C: utCalendar2_cal (utCalendar2_cal.c:225) > ==31403== by 0x43D1C3: compute_time_info (compute_time_info.c:111) > ==31403== by 0x416F92: read_large_scale_fields > (read_large_scale_fields.c:226) > ==31403== by 0x4257FA: wt_downscaling (wt_downscaling.c:115) > ==31403== by 0x403915: main (dsclim.c:191) It looks like the function make_udu_origin_zero() is freeing an invalid unit. This is outside the scope of the package. > ==31403== Address 0x75969a8 is 8 bytes inside a block of size 88 free'd > ==31403== at 0x4A05A31: free (vg_replace_malloc.c:325) > ==31403== by 0x34F9C04D06: XML_ParserFree (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x4C1922E: readXml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1B3C6: endElement (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x34F9C09E84: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0AB43: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0B96C: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0CC2A: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C03EF0: XML_ParseBuffer (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x4C193B6: readXml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C194F2: ut_read_xml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1BEC2: utInit (in > /data/local64/lib/libudunits2.so.0.1.0) Already answered. > ==31403== > ==31403== Invalid read of size 8 > ==31403== at 0x4C0F7E3: ut_free (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x42E090: utCalendar2 (utCalendar2_cal.c:324) > ==31403== by 0x43D1C3: compute_time_info (compute_time_info.c:111) > ==31403== by 0x416F92: read_large_scale_fields > (read_large_scale_fields.c:226) > ==31403== by 0x4257FA: wt_downscaling (wt_downscaling.c:115) > ==31403== by 0x403915: main (dsclim.c:191) Looks like a problem with compute_time_info(). > ==31403== Address 0x75969a8 is 8 bytes inside a block of size 88 free'd > ==31403== at 0x4A05A31: free (vg_replace_malloc.c:325) > ==31403== by 0x34F9C04D06: XML_ParserFree (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x4C1922E: readXml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1B3C6: endElement (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x34F9C09E84: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0AB43: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0B96C: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0CC2A: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C03EF0: XML_ParseBuffer (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x4C193B6: readXml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C194F2: ut_read_xml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1BEC2: utInit (in > /data/local64/lib/libudunits2.so.0.1.0) Already answered. > ==31403== > ==31403== Invalid read of size 8 > ==31403== at 0x4C10D83: productFree (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C10793: galileanFree (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C105B3: timestampFree (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x42E090: utCalendar2 (utCalendar2_cal.c:324) > ==31403== by 0x43D1C3: compute_time_info (compute_time_info.c:111) > ==31403== by 0x416F92: read_large_scale_fields > (read_large_scale_fields.c:226) > ==31403== by 0x4257FA: wt_downscaling (wt_downscaling.c:115) > ==31403== by 0x403915: main (dsclim.c:191) Already answered. > ==31403== Address 0x75969a8 is 8 bytes inside a block of size 88 free'd > ==31403== at 0x4A05A31: free (vg_replace_malloc.c:325) > ==31403== by 0x34F9C04D06: XML_ParserFree (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x4C1922E: readXml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1B3C6: endElement (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x34F9C09E84: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0AB43: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0B96C: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C0CC2A: ??? (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x34F9C03EF0: XML_ParseBuffer (in /lib64/libexpat.so.0.5.0) > ==31403== by 0x4C193B6: readXml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C194F2: ut_read_xml (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== by 0x4C1BEC2: utInit (in > /data/local64/lib/libudunits2.so.0.1.0) > ==31403== Already answered. I'd look at the file utCalendar2_cal.c to ensure that it was using the UDUNITS-2 API correctly. In particular, that it's not freeing unallocated units. Regards, Steve Emmerson Ticket Details =================== Ticket ID: UVE-844600 Department: Support UDUNITS Priority: Normal Status: Closed