-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIXED: Possible memory leak in various C API functions using ``BUF_MA…
…LLOC`` These functions could "stack" intermediate results, overflowing the string stack when used excessively inside a single foreign predicate or outside calls from Prolog (i.e., using "main" in foreign code).
- Loading branch information
1 parent
3458401
commit 1beb59e
Showing
2 changed files
with
70 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
Author: Jan Wielemaker and Anjo Anjewierden | ||
E-mail: [email protected] | ||
WWW: http://www.swi-prolog.org | ||
Copyright (c) 2011-2022, University of Amsterdam | ||
Copyright (c) 2011-2024, University of Amsterdam | ||
VU University Amsterdam | ||
SWI-Prolog Solutions b.v. | ||
All rights reserved. | ||
|
@@ -138,4 +138,17 @@ text_chr(const PL_chars_t *t, int chr) | |
return (size_t)-1; | ||
} | ||
|
||
/******************************* | ||
* STRING BUFFERS * | ||
*******************************/ | ||
|
||
#define PL_STRINGS_MARK_IF_MALLOC(flags) \ | ||
{ buf_mark_t __PL_mark; \ | ||
if ( flags&BUF_MALLOC ) \ | ||
PL_mark_string_buffers(&__PL_mark); | ||
#define PL_STRINGS_RELEASE_IF_MALLOC(flags) \ | ||
if ( flags&BUF_MALLOC ) \ | ||
PL_release_string_buffers_from_mark(__PL_mark); \ | ||
} | ||
|
||
#endif /*PL_TEXT_H_INCLUDED*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters