forked from pool/antlr3c
Accepting request 402674 from home:jirislaby:branches:network:telephony
- port patches from home:jirislaby:statica * add baselibs.conf to have 32bit libs too * add fix-LIST-memory-leak.patch * add fix-hash-double-free.patch - use standard library versioning and obsolete the old packages OBS-URL: https://build.opensuse.org/request/show/402674 OBS-URL: https://build.opensuse.org/package/show/network:telephony/antlr3c?expand=0&rev=9
This commit is contained in:
parent
65d5e02a1c
commit
f17979d6c0
@ -4,19 +4,29 @@ From: Jan Engelhardt <jengelh@inai.de>
|
||||
"-avoid-version" does not count for compatibility guarantees.
|
||||
Use one of -version-info, -release or -Wl,--version-script!
|
||||
---
|
||||
Makefile.am | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
Makefile.am | 2 +-
|
||||
configure.ac | 2 ++
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: libantlr3c-3.4/Makefile.am
|
||||
===================================================================
|
||||
--- libantlr3c-3.4.orig/Makefile.am
|
||||
+++ libantlr3c-3.4/Makefile.am
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -62,7 +62,7 @@ include_HEADERS = include/antlr3.h
|
||||
include/antlr3treeparser.h \
|
||||
antlr3config.h
|
||||
|
||||
-libantlr3c_la_LDFLAGS = -avoid-version
|
||||
+libantlr3c_la_LDFLAGS = -release ${PACKAGE_VERSION}
|
||||
+libantlr3c_la_LDFLAGS = -version-info @LIB_VERSION@
|
||||
|
||||
INCLUDES = -Iinclude
|
||||
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -34,6 +34,8 @@ AC_COPYRIGHT([
|
||||
])
|
||||
AC_CONFIG_SRCDIR(src/antlr3parser.c)
|
||||
|
||||
+LIB_VERSION=`echo $PACKAGE_VERSION|sed 's@\.@:@g'`
|
||||
+AC_SUBST([LIB_VERSION])
|
||||
|
||||
AC_ARG_ENABLE([debuginfo],
|
||||
[AS_HELP_STRING([--enable-debuginfo], [Compiles debug info into the library (default --disable-debuginfo)])],
|
||||
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jun 16 07:23:25 UTC 2016 - jslaby@suse.com
|
||||
|
||||
- port patches from home:jirislaby:statica
|
||||
* add baselibs.conf to have 32bit libs too
|
||||
* add fix-LIST-memory-leak.patch
|
||||
* add fix-hash-double-free.patch
|
||||
- use standard library versioning and obsolete the old packages
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Feb 6 12:00:03 UTC 2016 - mpluskal@suse.com
|
||||
|
||||
|
10
antlr3c.spec
10
antlr3c.spec
@ -17,7 +17,7 @@
|
||||
#
|
||||
|
||||
|
||||
%define soname libantlr3c-3_4
|
||||
%define soname libantlr3c3
|
||||
Name: antlr3c
|
||||
Version: 3.4
|
||||
Release: 0
|
||||
@ -26,8 +26,10 @@ License: BSD-3-Clause
|
||||
Group: Development/Libraries/C and C++
|
||||
Url: http://www.antlr3.org/
|
||||
Source: http://www.antlr3.org/download/C/lib%{name}-%{version}.tar.gz
|
||||
Patch0: fix-LIST-memory-leak.patch
|
||||
Patch1: antlr-64bit.diff
|
||||
Patch2: antlr-libversion.diff
|
||||
Patch3: fix-hash-double-free.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: gcc
|
||||
@ -48,6 +50,8 @@ Group: System/Libraries
|
||||
# From 13.3/TW201501 onwards
|
||||
Obsoletes: libantlr3c3_4 < %{version}
|
||||
Provides: libantlr3c3_4 = %{version}
|
||||
Obsoletes: libantlr3c-3_4 < %{version}
|
||||
Provides: libantlr3c-3_4 = %{version}
|
||||
|
||||
%description -n %{soname}
|
||||
ANTLR, ANother Tool for Language Recognition, is a language tool that provides a
|
||||
@ -73,8 +77,10 @@ develop programs using the antlr3c library.
|
||||
|
||||
%prep
|
||||
%setup -q -n lib%{name}-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
%build
|
||||
autoreconf -fiv
|
||||
@ -91,7 +97,7 @@ find %{buildroot} -type f -name "*.la" -delete -print
|
||||
|
||||
%files -n %{soname}
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/libantlr3c-%{version}.so
|
||||
%{_libdir}/libantlr3c.so.*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
|
1
baselibs.conf
Normal file
1
baselibs.conf
Normal file
@ -0,0 +1 @@
|
||||
libantlr3c-3_4
|
45
fix-LIST-memory-leak.patch
Normal file
45
fix-LIST-memory-leak.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 26aaa0f97e45025c48139bd39adc8808f9b4e697 Mon Sep 17 00:00:00 2001
|
||||
From: Jiri Slaby <jirislaby@gmail.com>
|
||||
Date: Thu, 17 Feb 2011 21:26:57 +0100
|
||||
Subject: [PATCH] collections: fix a LIST memory leak
|
||||
|
||||
When using antlr3 lists, Valgrind reports leaks like this:
|
||||
==30092== HEAP SUMMARY:
|
||||
==30092== in use at exit: 80 bytes in 2 blocks
|
||||
==30092== total heap usage: 286 allocs, 284 frees, 1,781,381 bytes allocated
|
||||
==30092==
|
||||
==30092== 40 bytes in 1 blocks are definitely lost in loss record 1 of 2
|
||||
==30092== at 0x4C2659D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
|
||||
==30092== by 0x4E333B8: antlr3HashPutI (antlr3collections.c:569)
|
||||
|
||||
It's because we use HASH as a representation for LIST. The LIST
|
||||
abstracts from HASH, so a user doesn't see a hash 'entry' itself.
|
||||
Hence if the user do list->remove, the HASH returns an 'entry' to us
|
||||
and we return entry->data to the user. But nobody frees the entry
|
||||
itself.
|
||||
|
||||
So free the entry from now on.
|
||||
|
||||
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
||||
---
|
||||
src/antlr3collections.c | 4 +++-
|
||||
1 files changed, 3 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/src/antlr3collections.c b/src/antlr3collections.c
|
||||
index 48ffe18..01f3f7e 100644
|
||||
--- a/src/antlr3collections.c
|
||||
+++ b/src/antlr3collections.c
|
||||
@@ -946,7 +946,9 @@ antlr3ListRemove (pANTLR3_LIST list, ANTLR3_INTKEY key)
|
||||
|
||||
if (entry != NULL)
|
||||
{
|
||||
- return entry->data;
|
||||
+ void *data = entry->data;
|
||||
+ ANTLR3_FREE(entry);
|
||||
+ return data;
|
||||
}
|
||||
else
|
||||
{
|
||||
--
|
||||
1.7.3.4
|
||||
|
33
fix-hash-double-free.patch
Normal file
33
fix-hash-double-free.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 6f5dad7d06620b4665303c542549d4c14f9fe784 Mon Sep 17 00:00:00 2001
|
||||
From: Jiri Slaby <jirislaby@gmail.com>
|
||||
Date: Sat, 19 Feb 2011 13:26:35 +0100
|
||||
Subject: [PATCH] collections: hash, fix double free
|
||||
|
||||
We should not free the hash entry in antlr3HashFree when we didn't
|
||||
strdup on that earlier.
|
||||
|
||||
I.e. make the free depend on table->doStrdup.
|
||||
|
||||
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
||||
---
|
||||
src/antlr3collections.c | 4 +++-
|
||||
1 files changed, 3 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/src/antlr3collections.c b/src/antlr3collections.c
|
||||
index 01f3f7e..3e32dc3 100644
|
||||
--- a/src/antlr3collections.c
|
||||
+++ b/src/antlr3collections.c
|
||||
@@ -237,7 +237,9 @@ antlr3HashFree(pANTLR3_HASH_TABLE table)
|
||||
*/
|
||||
if (entry->keybase.type == ANTLR3_HASH_TYPE_STR && entry->keybase.key.sKey != NULL)
|
||||
{
|
||||
- ANTLR3_FREE(entry->keybase.key.sKey);
|
||||
+ if (table->doStrdup == ANTLR3_TRUE) {
|
||||
+ ANTLR3_FREE(entry->keybase.key.sKey);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Free this entry
|
||||
--
|
||||
1.7.3.4
|
||||
|
Loading…
Reference in New Issue
Block a user