Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:munix9
gambas3
bp-666c1af7c66279abf9d6228be51fc33067d04608.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bp-666c1af7c66279abf9d6228be51fc33067d04608.patch of Package gambas3
From 666c1af7c66279abf9d6228be51fc33067d04608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= <benoit.minisini@gambas-basic.org> Date: Sun, 24 Mar 2024 23:57:08 +0100 Subject: [PATCH] Fix memory leaks when RDir() fails because of directory access rights. [INTERPRETER] * BUG: Fix memory leaks when RDir() fails because of directory access rights. --- main/gbx/gbx_subr_file.c | 5 ++++- main/share/gb_file_temp.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/main/gbx/gbx_subr_file.c b/main/gbx/gbx_subr_file.c index c551566f4..56fd92e8e 100644 --- a/main/gbx/gbx_subr_file.c +++ b/main/gbx/gbx_subr_file.c @@ -859,6 +859,9 @@ static void found_file(const char *path) else str = STRING_new(path, len); + if (!_result) + GB_ArrayNew(&_result, T_STRING, 0); + *((char **)GB_ArrayAdd(_result)) = str; } @@ -885,7 +888,7 @@ void SUBR_rdir(ushort code) else _pattern = NULL; - GB_ArrayNew(&_result, T_STRING, 0); + _result = NULL; if (!path || *path == 0) path = "."; diff --git a/main/share/gb_file_temp.h b/main/share/gb_file_temp.h index ba9dcf911..3aab5dffb 100644 --- a/main/share/gb_file_temp.h +++ b/main/share/gb_file_temp.h @@ -848,13 +848,13 @@ void FILE_recursive_dir(const char *dir, void (*found)(const char *), void (*aft else if (!FILE_is_dir(dir)) return; + FILE_dir_first(dir, NULL, attr != GB_STAT_DIRECTORY ? 0 : GB_STAT_DIRECTORY); + file_rdir_path = STRING_new_zero(dir); file_rdir_len = STRING_length(file_rdir_path); if (file_rdir_path[file_rdir_len - 1] == '/') file_rdir_len--; - FILE_dir_first(dir, NULL, attr != GB_STAT_DIRECTORY ? 0 : GB_STAT_DIRECTORY); - #if OPT_NLINK if (file_dir && !FILE_is_relative(dir)) { -- GitLab
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