path: root/include
authorSergey Poznyakoff <>2016-02-21 20:58:19 (GMT)
committer Sergey Poznyakoff <>2016-07-04 12:43:13 (GMT)
commit8ce8bfb30c64785d0dddfb319e48ff6cbc5f4405 (patch) (side-by-side diff)
tree6f375a46b6f85ec469e89707a33f28718fe24f60 /include
parent1705e5d927dba731c135e1192bfdee421829786a (diff)
Prevent memory leaks when re-processing values of string type.
Port of a3f25ce2 from master. * include/grecs/table.h (GRECS_CONST): New flag. * src/tree.c (grecs_string_convert): For string types, free the old value prior to assigning the new one, unless the GRECS_CONST flag is set. In any case, clear the GRECS_CONST flag after assigning new value.
Diffstat (limited to 'include') (more/less context) (ignore whitespace changes)
1 files changed, 10 insertions, 6 deletions
diff --git a/include/grecs/table.h b/include/grecs/table.h
index 4210c6f..d7d0a8c 100644
--- a/include/grecs/table.h
+++ b/include/grecs/table.h
@@ -40,12 +40,16 @@ enum grecs_data_type {
-#define GRECS_DFLT 0x00
-#define GRECS_AGGR 0x01
-#define GRECS_MULT 0x02
-#define GRECS_INAC 0x04
-#define GRECS_LIST 0x08
-#define GRECS_HIDDEN 0x10
+#define GRECS_DFLT 0x00 /* Default keyword flags */
+#define GRECS_AGGR 0x01 /* Multiple entries aggregate */
+#define GRECS_MULT 0x02 /* Statement can appear multiple times */
+#define GRECS_INAC 0x04 /* Inactive keyword */
+#define GRECS_LIST 0x08 /* Value is a list of declared type */
+#define GRECS_HIDDEN 0x10 /* Hidden keyword: don't display in help output */
+#define GRECS_CONST 0x20 /* For string types: initial value is constant,
+ don't try to free it before assigning new value.
+ This flag is cleared after the first assignment.
+ */
enum grecs_callback_command {

Return to:

Send suggestions and report system problems to the System administrator.