gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4031-g0446a26


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4031-g0446a26
Date: Mon, 13 Jul 2020 09:05:31 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-5.1-stable has been updated
       via  0446a2679b81c5e319dfe74074d1b9ab441213f1 (commit)
      from  dd9a8ec89c51dba47e63640a9705017399ec32d0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=0446a2679b81c5e319dfe74074d1b9ab441213f1

commit 0446a2679b81c5e319dfe74074d1b9ab441213f1
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Mon Jul 13 16:05:08 2020 +0300

    Fix memory leak in intdiv extension. Update doc.

diff --git a/doc/ChangeLog b/doc/ChangeLog
index 0a4c379..47f57ee 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,9 @@
+2020-07-13         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * gawktexi.in (General Data Types): Document that MPFR
+       data types are copied and have to be freed in the
+       extension.
+
 2020-07-02         Arnold D. Robbins     <arnold@skeeve.com>
 
        * gawk.1, gawktexi.in: Document -I/--trace option.
diff --git a/doc/gawk.info b/doc/gawk.info
index 62bea4b..3b65140 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -24896,6 +24896,11 @@ use them.
      integer (type 'mpz_ptr'), or an MPFR floating-point value (type
      'mpfr_ptr_t'), and cast it appropriately.
 
+          CAUTION:: Any MPFR or MPZ values that you create and pass to
+          'gawk' to save are _copied_.  This means you are responsible
+          to release the storage once you're done with it.  See the
+          sample 'intdiv' extension for some example code.
+
 'typedef void *awk_scalar_t;'
      Scalars can be represented as an opaque type.  These values are
      obtained from 'gawk' and then passed back into it.  This is
@@ -37785,144 +37790,144 @@ Node: Extension API Description998110
 Node: Extension API Functions Introduction999752
 Ref: table-api-std-headers1001588
 Node: General Data Types1005453
-Ref: General Data Types-Footnote-11013814
-Node: Memory Allocation Functions1014113
-Ref: Memory Allocation Functions-Footnote-11018323
-Node: Constructor Functions1018422
-Node: Registration Functions1022008
-Node: Extension Functions1022693
-Node: Exit Callback Functions1028015
-Node: Extension Version String1029265
-Node: Input Parsers1029928
-Node: Output Wrappers1042649
-Node: Two-way processors1047161
-Node: Printing Messages1049426
-Ref: Printing Messages-Footnote-11050597
-Node: Updating ERRNO1050750
-Node: Requesting Values1051489
-Ref: table-value-types-returned1052226
-Node: Accessing Parameters1053162
-Node: Symbol Table Access1054397
-Node: Symbol table by name1054909
-Ref: Symbol table by name-Footnote-11057933
-Node: Symbol table by cookie1058061
-Ref: Symbol table by cookie-Footnote-11062246
-Node: Cached values1062310
-Ref: Cached values-Footnote-11065846
-Node: Array Manipulation1065999
-Ref: Array Manipulation-Footnote-11067090
-Node: Array Data Types1067127
-Ref: Array Data Types-Footnote-11069785
-Node: Array Functions1069877
-Node: Flattening Arrays1074375
-Node: Creating Arrays1081351
-Node: Redirection API1086118
-Node: Extension API Variables1088951
-Node: Extension Versioning1089662
-Ref: gawk-api-version1090091
-Node: Extension GMP/MPFR Versioning1091822
-Node: Extension API Informational Variables1093450
-Node: Extension API Boilerplate1094523
-Node: Changes from API V11098497
-Node: Finding Extensions1100069
-Node: Extension Example1100628
-Node: Internal File Description1101426
-Node: Internal File Ops1105506
-Ref: Internal File Ops-Footnote-11116856
-Node: Using Internal File Ops1116996
-Ref: Using Internal File Ops-Footnote-11119379
-Node: Extension Samples1119653
-Node: Extension Sample File Functions1121182
-Node: Extension Sample Fnmatch1128831
-Node: Extension Sample Fork1130318
-Node: Extension Sample Inplace1131536
-Node: Extension Sample Ord1135161
-Node: Extension Sample Readdir1135997
-Ref: table-readdir-file-types1136886
-Node: Extension Sample Revout1137953
-Node: Extension Sample Rev2way1138542
-Node: Extension Sample Read write array1139282
-Node: Extension Sample Readfile1141224
-Node: Extension Sample Time1142319
-Node: Extension Sample API Tests1144071
-Node: gawkextlib1144563
-Node: Extension summary1147481
-Node: Extension Exercises1151183
-Node: Language History1152425
-Node: V7/SVR3.11154081
-Node: SVR41156233
-Node: POSIX1157667
-Node: BTL1159048
-Node: POSIX/GNU1159777
-Node: Feature History1165555
-Node: Common Extensions1181874
-Node: Ranges and Locales1183157
-Ref: Ranges and Locales-Footnote-11187773
-Ref: Ranges and Locales-Footnote-21187800
-Ref: Ranges and Locales-Footnote-31188035
-Node: Contributors1188258
-Node: History summary1194255
-Node: Installation1195635
-Node: Gawk Distribution1196579
-Node: Getting1197063
-Node: Extracting1198026
-Node: Distribution contents1199664
-Node: Unix Installation1206144
-Node: Quick Installation1206826
-Node: Shell Startup Files1209240
-Node: Additional Configuration Options1210329
-Node: Configuration Philosophy1212644
-Node: Non-Unix Installation1215013
-Node: PC Installation1215473
-Node: PC Binary Installation1216311
-Node: PC Compiling1216746
-Node: PC Using1217863
-Node: Cygwin1221416
-Node: MSYS1222640
-Node: VMS Installation1223242
-Node: VMS Compilation1224033
-Ref: VMS Compilation-Footnote-11225262
-Node: VMS Dynamic Extensions1225320
-Node: VMS Installation Details1227005
-Node: VMS Running1229258
-Node: VMS GNV1233537
-Node: VMS Old Gawk1234272
-Node: Bugs1234743
-Node: Bug address1235406
-Node: Usenet1238388
-Node: Maintainers1239392
-Node: Other Versions1240577
-Node: Installation summary1247665
-Node: Notes1248874
-Node: Compatibility Mode1249668
-Node: Additions1250450
-Node: Accessing The Source1251375
-Node: Adding Code1252812
-Node: New Ports1259031
-Node: Derived Files1263406
-Ref: Derived Files-Footnote-11269066
-Ref: Derived Files-Footnote-21269101
-Ref: Derived Files-Footnote-31269699
-Node: Future Extensions1269813
-Node: Implementation Limitations1270471
-Node: Extension Design1271681
-Node: Old Extension Problems1272825
-Ref: Old Extension Problems-Footnote-11274343
-Node: Extension New Mechanism Goals1274400
-Ref: Extension New Mechanism Goals-Footnote-11277764
-Node: Extension Other Design Decisions1277953
-Node: Extension Future Growth1280066
-Node: Notes summary1280672
-Node: Basic Concepts1281830
-Node: Basic High Level1282511
-Ref: figure-general-flow1282793
-Ref: figure-process-flow1283478
-Ref: Basic High Level-Footnote-11286779
-Node: Basic Data Typing1286964
-Node: Glossary1290292
-Node: Copying1322177
-Node: GNU Free Documentation License1359720
-Node: Index1384840
+Ref: General Data Types-Footnote-11014084
+Node: Memory Allocation Functions1014383
+Ref: Memory Allocation Functions-Footnote-11018593
+Node: Constructor Functions1018692
+Node: Registration Functions1022278
+Node: Extension Functions1022963
+Node: Exit Callback Functions1028285
+Node: Extension Version String1029535
+Node: Input Parsers1030198
+Node: Output Wrappers1042919
+Node: Two-way processors1047431
+Node: Printing Messages1049696
+Ref: Printing Messages-Footnote-11050867
+Node: Updating ERRNO1051020
+Node: Requesting Values1051759
+Ref: table-value-types-returned1052496
+Node: Accessing Parameters1053432
+Node: Symbol Table Access1054667
+Node: Symbol table by name1055179
+Ref: Symbol table by name-Footnote-11058203
+Node: Symbol table by cookie1058331
+Ref: Symbol table by cookie-Footnote-11062516
+Node: Cached values1062580
+Ref: Cached values-Footnote-11066116
+Node: Array Manipulation1066269
+Ref: Array Manipulation-Footnote-11067360
+Node: Array Data Types1067397
+Ref: Array Data Types-Footnote-11070055
+Node: Array Functions1070147
+Node: Flattening Arrays1074645
+Node: Creating Arrays1081621
+Node: Redirection API1086388
+Node: Extension API Variables1089221
+Node: Extension Versioning1089932
+Ref: gawk-api-version1090361
+Node: Extension GMP/MPFR Versioning1092092
+Node: Extension API Informational Variables1093720
+Node: Extension API Boilerplate1094793
+Node: Changes from API V11098767
+Node: Finding Extensions1100339
+Node: Extension Example1100898
+Node: Internal File Description1101696
+Node: Internal File Ops1105776
+Ref: Internal File Ops-Footnote-11117126
+Node: Using Internal File Ops1117266
+Ref: Using Internal File Ops-Footnote-11119649
+Node: Extension Samples1119923
+Node: Extension Sample File Functions1121452
+Node: Extension Sample Fnmatch1129101
+Node: Extension Sample Fork1130588
+Node: Extension Sample Inplace1131806
+Node: Extension Sample Ord1135431
+Node: Extension Sample Readdir1136267
+Ref: table-readdir-file-types1137156
+Node: Extension Sample Revout1138223
+Node: Extension Sample Rev2way1138812
+Node: Extension Sample Read write array1139552
+Node: Extension Sample Readfile1141494
+Node: Extension Sample Time1142589
+Node: Extension Sample API Tests1144341
+Node: gawkextlib1144833
+Node: Extension summary1147751
+Node: Extension Exercises1151453
+Node: Language History1152695
+Node: V7/SVR3.11154351
+Node: SVR41156503
+Node: POSIX1157937
+Node: BTL1159318
+Node: POSIX/GNU1160047
+Node: Feature History1165825
+Node: Common Extensions1182144
+Node: Ranges and Locales1183427
+Ref: Ranges and Locales-Footnote-11188043
+Ref: Ranges and Locales-Footnote-21188070
+Ref: Ranges and Locales-Footnote-31188305
+Node: Contributors1188528
+Node: History summary1194525
+Node: Installation1195905
+Node: Gawk Distribution1196849
+Node: Getting1197333
+Node: Extracting1198296
+Node: Distribution contents1199934
+Node: Unix Installation1206414
+Node: Quick Installation1207096
+Node: Shell Startup Files1209510
+Node: Additional Configuration Options1210599
+Node: Configuration Philosophy1212914
+Node: Non-Unix Installation1215283
+Node: PC Installation1215743
+Node: PC Binary Installation1216581
+Node: PC Compiling1217016
+Node: PC Using1218133
+Node: Cygwin1221686
+Node: MSYS1222910
+Node: VMS Installation1223512
+Node: VMS Compilation1224303
+Ref: VMS Compilation-Footnote-11225532
+Node: VMS Dynamic Extensions1225590
+Node: VMS Installation Details1227275
+Node: VMS Running1229528
+Node: VMS GNV1233807
+Node: VMS Old Gawk1234542
+Node: Bugs1235013
+Node: Bug address1235676
+Node: Usenet1238658
+Node: Maintainers1239662
+Node: Other Versions1240847
+Node: Installation summary1247935
+Node: Notes1249144
+Node: Compatibility Mode1249938
+Node: Additions1250720
+Node: Accessing The Source1251645
+Node: Adding Code1253082
+Node: New Ports1259301
+Node: Derived Files1263676
+Ref: Derived Files-Footnote-11269336
+Ref: Derived Files-Footnote-21269371
+Ref: Derived Files-Footnote-31269969
+Node: Future Extensions1270083
+Node: Implementation Limitations1270741
+Node: Extension Design1271951
+Node: Old Extension Problems1273095
+Ref: Old Extension Problems-Footnote-11274613
+Node: Extension New Mechanism Goals1274670
+Ref: Extension New Mechanism Goals-Footnote-11278034
+Node: Extension Other Design Decisions1278223
+Node: Extension Future Growth1280336
+Node: Notes summary1280942
+Node: Basic Concepts1282100
+Node: Basic High Level1282781
+Ref: figure-general-flow1283063
+Ref: figure-process-flow1283748
+Ref: Basic High Level-Footnote-11287049
+Node: Basic Data Typing1287234
+Node: Glossary1290562
+Node: Copying1322447
+Node: GNU Free Documentation License1359990
+Node: Index1385110
 
 End Tag Table
 
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 577a114..0a6d13c 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -59,7 +59,7 @@
 @c applies to and all the info about who's publishing this edition
 
 @c These apply across the board.
-@set UPDATE-MONTH June, 2020
+@set UPDATE-MONTH July, 2020
 @set VERSION 5.1
 @set PATCHLEVEL 0
 
@@ -34560,6 +34560,13 @@ in data received from @command{gawk}. In addition, by 
examining the
 member is either a GMP integer (type @code{mpz_ptr}), or an MPFR
 floating-point value (type @code{mpfr_ptr_t}), and cast it appropriately.
 
+@quotation CAUTION:
+Any MPFR or MPZ values that you create and pass to @command{gawk}
+to save are @emph{copied}. This means you are responsible to release
+the storage once you're done with it. See the sample @code{intdiv}
+extension for some example code.
+@end quotation
+
 @item typedef void *awk_scalar_t;
 Scalars can be represented as an opaque type. These values are obtained
 from @command{gawk} and then passed back into it. This is discussed
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 73b30c3..8cd1efe 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -54,7 +54,7 @@
 @c applies to and all the info about who's publishing this edition
 
 @c These apply across the board.
-@set UPDATE-MONTH June, 2020
+@set UPDATE-MONTH July, 2020
 @set VERSION 5.1
 @set PATCHLEVEL 0
 
@@ -33531,6 +33531,13 @@ in data received from @command{gawk}. In addition, by 
examining the
 member is either a GMP integer (type @code{mpz_ptr}), or an MPFR
 floating-point value (type @code{mpfr_ptr_t}), and cast it appropriately.
 
+@quotation CAUTION:
+Any MPFR or MPZ values that you create and pass to @command{gawk}
+to save are @emph{copied}. This means you are responsible to release
+the storage once you're done with it. See the sample @code{intdiv}
+extension for some example code.
+@end quotation
+
 @item typedef void *awk_scalar_t;
 Scalars can be represented as an opaque type. These values are obtained
 from @command{gawk} and then passed back into it. This is discussed
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 223b817..856bff5 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,9 @@
+2020-07-13         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * intdiv.c (do_intdiv): Release the quotient and remainder
+       values when done with them. Fixes a memory leak. Thanks to
+       Andrew Schorr and valgrind for the report.
+
 2020-06-10         Arnold D. Robbins     <arnold@skeeve.com>
 
        Miscellanious fixes from Michael Builov <mbuilov@gmail.com>.
diff --git a/extension/intdiv.c b/extension/intdiv.c
index 4e3ae50..34b19a0 100644
--- a/extension/intdiv.c
+++ b/extension/intdiv.c
@@ -223,6 +223,13 @@ do_intdiv(int nargs, awk_value_t *result, struct 
awk_ext_func *unused)
                array_set_mpz(array, "quotient", 8, quotient);
                array_set_mpz(array, "remainder", 9, remainder);
 
+               /* values were copied, so release out local ones */
+               mpz_clear(quotient);
+               gawk_free(quotient);
+
+               mpz_clear(remainder);
+               gawk_free(remainder);
+
                /* release temporary variables */
                if (numer == numer_tmp)
                        mpz_clear(numer);

-----------------------------------------------------------------------

Summary of changes:
 doc/ChangeLog       |   6 ++
 doc/gawk.info       | 281 ++++++++++++++++++++++++++--------------------------
 doc/gawk.texi       |   9 +-
 doc/gawktexi.in     |   9 +-
 extension/ChangeLog |   6 ++
 extension/intdiv.c  |   7 ++
 6 files changed, 178 insertions(+), 140 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]