]> git.tuebingen.mpg.de Git - osl.git/commitdiff
osl_update_object(): Honor OSL_DONT_FREE.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 4 Jan 2015 00:34:26 +0000 (00:34 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 18 Feb 2015 14:11:29 +0000 (15:11 +0100)
When osl_update_object() is called to replace an object of
an OSL_NO_STORAGE column, it frees the old object even if the
OSL_DONT_FREE flag is set for the column, which is wrong. This patch
changes the function to call free() only if OSL_DONT_FREE is unset.

osl.c

diff --git a/osl.c b/osl.c
index c6959acc0780144715f5a201c599380fcb9f4108..80bec0f4fb8fcc8b7ea38b9329a3aa04a54feacd 100644 (file)
--- a/osl.c
+++ b/osl.c
@@ -1572,7 +1572,8 @@ __export int osl_update_object(struct osl_table *t, const struct osl_row *r,
        }
        remove_rb_node(t, col_num, r);
        if (cd->storage_type == OSL_NO_STORAGE) { /* TODO: If fixed size, reuse object? */
-               free(r->volatile_objects[col->volatile_num].data);
+               if (!(cd->storage_flags & OSL_DONT_FREE))
+                       free(r->volatile_objects[col->volatile_num].data);
                r->volatile_objects[col->volatile_num] = *obj;
        } else if (cd->storage_type == OSL_DISK_STORAGE) {
                char *ds_name;