diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2009-03-27 15:05:34 +0000 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2009-03-27 15:05:34 +0000 |
| commit | 7696062fbdb84fe281fcce5d1298ee592e70e113 (patch) | |
| tree | ca9b0a713d0ec4a30b3750bae329a082eb91392e | |
| parent | e59c45e5981d4eec1984c03754d1f15529aa590d (diff) | |
Core: Fix corner case in deallocation macros
* lasso/utils.h: When setting strings using lasso_assing_string or
lasso_assign_new_string, verify that new string is different than the
target value string before deallocating the target.
| -rw-r--r-- | lasso/utils.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lasso/utils.h b/lasso/utils.h index 49e1b11f..011d4d1e 100644 --- a/lasso/utils.h +++ b/lasso/utils.h @@ -153,7 +153,8 @@ #define lasso_assign_new_string(dest,src) \ { \ - if (dest) g_free(dest); \ + if (dest != src) \ + lasso_release_string(dest); \ dest = src; \ } @@ -170,7 +171,7 @@ #define lasso_assign_new_gobject(dest,src) \ { \ lasso_check_type_equality(dest, src); \ - if (dest) \ + if (dest != (void*)src) \ g_object_unref(dest); \ dest = (void*)(src); \ } |
