Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.2:Staging:N
libcdio
libcdio-0.94-leak-08.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libcdio-0.94-leak-08.patch of Package libcdio
Partial patch. The original commit breaks API and ABI. This patch extracts only leak fixes. From bf7ee89d6eb22887f356d90d03c03e4255dd236f Mon Sep 17 00:00:00 2001 From: "R. Bernstein" <rocky@gnu.org> Date: Thu, 30 Nov 2017 06:38:17 -0500 Subject: [PATCH 8/20] Lots of cleanups... isio9660.h, iso9660.c, iso9660.hpp remove mode2 from is9660_fs_stat_translate() and in C++ version go over doxygen comments. (More is needed) iso-info.c, cd-info.c: use alloca() instead of malloc() where possible test/Mamefile.am: correct remake comments for check-leaks testisocd2.c: make leak free iso9660_fs.c: fix memory leak in iso9660_ifs_find_lsn --- configure.ac | 2 +- include/cdio++/iso9660.hpp | 14 ++-- include/cdio/iso9660.h | 112 +++++++++++++++++++++++------ lib/cdio++/iso9660.cpp | 8 +-- lib/iso9660/iso9660_fs.c | 144 ++++++++++++++++++++++++++++++------- src/cd-info.c | 12 ++-- test/Makefile.am | 2 +- test/driver/Makefile.am | 2 +- test/testisocd2.c | 13 ++-- 9 files changed, 231 insertions(+), 78 deletions(-) Index: libcdio-0.94/lib/iso9660/iso9660_fs.c =================================================================== --- libcdio-0.94.orig/lib/iso9660/iso9660_fs.c +++ libcdio-0.94/lib/iso9660/iso9660_fs.c @@ -1527,8 +1527,12 @@ iso9660_stat_t * iso9660_ifs_find_lsn(iso9660_t *p_iso, lsn_t i_lsn) { char *psz_full_filename = NULL; - return find_lsn_recurse (p_iso, (iso9660_readdir_t *) iso9660_ifs_readdir, - "/", i_lsn, &psz_full_filename); + iso9660_stat_t *ret = + find_lsn_recurse (p_iso, (iso9660_readdir_t *) iso9660_ifs_readdir, + "/", i_lsn, &psz_full_filename); + if (psz_full_filename != NULL) + free(psz_full_filename); + return ret; } /*! @@ -1547,6 +1551,9 @@ iso9660_ifs_find_lsn_with_path(iso9660_t /*! Free the passed iso9660_stat_t structure. + + @param p_stat iso9660 stat buffer to free. + */ void iso9660_stat_free(iso9660_stat_t *p_stat) Index: libcdio-0.94/src/cd-info.c =================================================================== --- libcdio-0.94.orig/src/cd-info.c +++ libcdio-0.94/src/cd-info.c @@ -68,6 +68,10 @@ #include <errno.h> #endif +#ifdef HAVE_ALLOCA_H +#include <alloca.h> +#endif + #define STRONG "__________________________________\n" #define NORMAL "" @@ -543,7 +547,7 @@ print_iso9660_recurse (CdIo_t *p_cdio, c CdioList_t *p_dirlist = _cdio_list_new (); CdioListNode_t *entnode; uint8_t i_joliet_level; - char *translated_name = (char *) malloc(4096); + char *translated_name = (char *) alloca(4096); size_t translated_name_size = 4096; i_joliet_level = (opts.no_joliet) @@ -556,7 +560,6 @@ print_iso9660_recurse (CdIo_t *p_cdio, c if (NULL == p_entlist) { report( stderr, "Error getting above directory information\n" ); - free(translated_name); free(p_dirlist); return; } @@ -570,8 +573,6 @@ print_iso9660_recurse (CdIo_t *p_cdio, c char _fullname[4096] = { 0, }; if (strlen(psz_iso_name) >= translated_name_size) { translated_name_size = strlen(psz_iso_name)+1; - free(translated_name); - translated_name = (char *) malloc(translated_name_size); if (!translated_name) { report( stderr, "Error allocating memory\n" ); _cdio_list_free3 (p_dirlist, true, free); @@ -603,7 +604,6 @@ print_iso9660_recurse (CdIo_t *p_cdio, c p_statbuf->rr.i_symlink = 0; } } - free (translated_name); _cdio_list_free3 (p_entlist, true, (CdioDataFree_t) iso9660_stat_free); Index: libcdio-0.94/test/testisocd2.c =================================================================== --- libcdio-0.94.orig/test/testisocd2.c +++ libcdio-0.94/test/testisocd2.c @@ -134,7 +134,6 @@ main(int argc, const char *argv[]) rc = 5; goto exit; } - free(psz_path); } else { fprintf(stderr, "Path returned for fs_find_lsn_with_path is NULL\n"); rc = 6; @@ -152,11 +151,13 @@ main(int argc, const char *argv[]) goto exit; } exit: - iso9660_stat_free(p_statbuf2); - iso9660_stat_free(p_statbuf3); - iso9660_stat_free(p_statbuf); - iso9660_close(p_iso); - exit(rc); + if (psz_path != NULL) + free(psz_path); + iso9660_stat_free(p_statbuf2); + iso9660_stat_free(p_statbuf3); + iso9660_stat_free(p_statbuf); + iso9660_close(p_iso); + exit(rc); } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor