[Libreoffice-commits] core.git: 2 commits - external/liblangtag i18nlangtag/source
Stephan Bergmann
sbergman at redhat.com
Mon May 26 05:26:42 PDT 2014
external/liblangtag/UnpackedTarball_langtag.mk | 3 +++
external/liblangtag/liblangtag-leak.patch.0 | 10 ++++++++++
i18nlangtag/source/languagetag/languagetag.cxx | 6 +++++-
3 files changed, 18 insertions(+), 1 deletion(-)
New commits:
commit 0fe40023df5d28a46bea5632835f65e11e1954c0
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon May 26 14:25:58 2014 +0200
Fix refcounting
Change-Id: I2225b2a2dc0648ec3b9e2af251cd1a3502199383
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index 8a96bde..483cf98 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -429,8 +429,10 @@ LanguageTagImpl& LanguageTagImpl::operator=( const LanguageTagImpl & rLanguageTa
maCachedScript = rLanguageTagImpl.maCachedScript;
maCachedCountry = rLanguageTagImpl.maCachedCountry;
maCachedVariants = rLanguageTagImpl.maCachedVariants;
+ lt_tag_t * oldTag = mpImplLangtag;
mpImplLangtag = rLanguageTagImpl.mpImplLangtag ?
lt_tag_copy( rLanguageTagImpl.mpImplLangtag) : NULL;
+ lt_tag_unref(oldTag);
mnLangID = rLanguageTagImpl.mnLangID;
meIsValid = rLanguageTagImpl.meIsValid;
meIsIsoLocale = rLanguageTagImpl.meIsIsoLocale;
@@ -444,8 +446,10 @@ LanguageTagImpl& LanguageTagImpl::operator=( const LanguageTagImpl & rLanguageTa
mbCachedScript = rLanguageTagImpl.mbCachedScript;
mbCachedCountry = rLanguageTagImpl.mbCachedCountry;
mbCachedVariants = rLanguageTagImpl.mbCachedVariants;
- if (mpImplLangtag)
+ if (mpImplLangtag && !oldTag)
theDataRef::get().incRef();
+ else if (!mpImplLangtag && oldTag)
+ theDataRef::get().decRef();
return *this;
}
commit f5d90767d199baeaf61706ecd52f29a34f96b62c
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon May 26 14:25:26 2014 +0200
external/liblangtag: Fix memory leak
Change-Id: I7d58c1aad5ec21f14569caedbada56cc31a5ff99
diff --git a/external/liblangtag/UnpackedTarball_langtag.mk b/external/liblangtag/UnpackedTarball_langtag.mk
index 90068cb..2951368 100644
--- a/external/liblangtag/UnpackedTarball_langtag.mk
+++ b/external/liblangtag/UnpackedTarball_langtag.mk
@@ -15,6 +15,8 @@ $(eval $(call gb_UnpackedTarball_set_pre_action,langtag,\
$(GNUTAR) -x -j -f $(gb_UnpackedTarget_TARFILE_LOCATION)/$(LANGTAGREG_TARBALL) \
))
+# external/liblangtag/liblangtag-leak.patch.0 upstream:
+# <https://bitbucket.org/tagoh/liblangtag/pull-request/8/fix-memory-leak/diff>
$(eval $(call gb_UnpackedTarball_add_patches,langtag,\
external/liblangtag/liblangtag-0.5.1-msvc-warning.patch \
external/liblangtag/liblangtag-0.5.1-vsnprintf.patch \
@@ -27,6 +29,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,langtag,\
external/liblangtag/liblangtag-0.5.1-windows-do-not-prepend-dir-separator.patch \
external/liblangtag/liblangtag-0.5.1-unistd.patch \
external/liblangtag/liblangtag-0.5.1-include-last-record-in-language-subtag-registry.patch \
+ external/liblangtag/liblangtag-leak.patch.0 \
))
ifeq ($(OS),WNT)
diff --git a/external/liblangtag/liblangtag-leak.patch.0 b/external/liblangtag/liblangtag-leak.patch.0
new file mode 100644
index 0000000..4a74d68
--- /dev/null
+++ b/external/liblangtag/liblangtag-leak.patch.0
@@ -0,0 +1,10 @@
+--- liblangtag/lt-tag.c
++++ liblangtag/lt-tag.c
+@@ -1408,6 +1408,7 @@
+ lt_variant_ref(lt_list_value(l)),
+ (lt_destroy_func_t)lt_variant_unref);
+ }
++ lt_mem_add_ref(&retval->parent, retval->variants, lt_list_free);
+ }
+ if (tag->extension) {
+ lt_tag_set_extension(retval, lt_extension_copy(tag->extension));
More information about the Libreoffice-commits
mailing list