aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-02-21 22:58:19 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-07-04 15:43:13 +0300
commit8ce8bfb30c64785d0dddfb319e48ff6cbc5f4405 (patch)
tree6f375a46b6f85ec469e89707a33f28718fe24f60 /include
parent1705e5d927dba731c135e1192bfdee421829786a (diff)
downloadgrecs-8ce8bfb30c64785d0dddfb319e48ff6cbc5f4405.tar.gz
grecs-8ce8bfb30c64785d0dddfb319e48ff6cbc5f4405.tar.bz2
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')
-rw-r--r--include/grecs/table.h16
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 {
grecs_type_null
};
-#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 {
grecs_callback_section_begin,

Return to:

Send suggestions and report system problems to the System administrator.