Memory leaks from dc_field_add_string
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
Línea de trabajo
Start in libdivecomputer/src/field-cache.c and trace dc_parser_deallocate through the three parsers that use dc_field_cache, including shearwater_predator_parser.c. Reproduce the download with dctool under ASAN, inspect each parser's destroy path, and verify that cached strings are released without leaks.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
When doing a download, with example dctool, built with asan, one can clearly see the memory leaks from the strdup happening in the field-cache:
#0 0x7d4d7b32478c in strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:617
#1 0x645f8c5da40f in dc_field_add_string ../../libdivecomputer/src/field-cache.c:26
#2 0x645f8c5da654 in dc_field_add_string_fmt ../../libdivecomputer/src/field-cache.c:52
#3 0x645f8c561ad9 in add_sensor_state ../../libdivecomputer/src/shearwater_predator_parser.c:461
#4 0x645f8c567043 in shearwater_predator_parser_cache ../../libdivecomputer/src/shearwater_predator_parser.c:973
#5 0x645f8c560f4a in shearwater_predator_parser_get_datetime ../../libdivecomputer/src/shearwater_predator_parser.c:349
#6 0x645f8c4b52e3 in dc_parser_get_datetime ../../libdivecomputer/src/parser.c:380
#7 0x645f8c4a7cbe in dctool_xml_output_write ../../libdivecomputer/examples/output_xml.c:255
#8 0x645f8c4a62d5 in dctool_output_write ../../libdivecomputer/examples/output.c:61
#9 0x645f8c49ef5c in dive_cb ../../libdivecomputer/examples/dctool_download.c:92
#10 0x645f8c56cefd in shearwater_petrel_device_foreach ../../libdivecomputer/src/shearwater_petrel.c:339
#11 0x645f8c4b30b0 in dc_device_foreach ../../libdivecomputer/src/device.c:423
#12 0x645f8c49fddd in download ../../libdivecomputer/examples/dctool_download.c:227
#13 0x645f8c4a0de6 in dctool_download_run ../../libdivecomputer/examples/dctool_download.c:360
#14 0x645f8c49d0af in main ../../libdivecomputer/examples/dctool.c:312
#15 0x7d4d7ae2a600 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:59
#16 0x7d4d7ae2a717 in __libc_start_main_impl ../csu/libc-start.c:360
#17 0x645f8c499234 in _start (libdivecomputer-build/examples/dctool+0x66234) (BuildId: 506f83238fb80c0b06b6bbd4ec421c6fec390b98)
This is because the dc_parser_deallocate has no clue about the value strings kept in the struct dc_field_cache, and thus can't free them.
The 3 parsers using the dc_field_cache should either have a destroy function added to them which frees the cached strings or have their existing destroy function updated to free the cached strings.
- Lenguaje dominante
- C
- Estrellas
- 126
- Forks
- 116
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 13
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de subsurface/libdc
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
subsurface/libdc#110 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
subsurface/libdc#91 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
Todos los issues de subsurface/libdc
Issues similares
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
ClickHouse/pg_clickhouse#383 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
johnsonjh/emu2-cpm86#68 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Zenmap CrashAbiertoZenmap
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
BasedHardware/omi#19306 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
fastfetch-cli/fastfetch#2619 ·
Los mantenedores suelen responder en 1 día