aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Podgorny <pasis.ua@gmail.com>2013-03-20 22:39:43 +0200
committerDmitry Podgorny <pasis.ua@gmail.com>2013-03-20 22:39:43 +0200
commit292ba138161dc8aabb14dd738a38b0cbe15a6e68 (patch)
treeb911e4f98d09092ee05fb74bbbbefc7d84a4ddf0
parentffe7c06bc54d5b158bd0bb8fc1e304a7a0e8296d (diff)
downloadprofanity-292ba138161dc8aabb14dd738a38b0cbe15a6e68.tar.gz
profanity-292ba138161dc8aabb14dd738a38b0cbe15a6e68.tar.xz
dev-libs/libstrophe: added 2 patches
libstrophe-fix-crash-on-non-latin1.patch libstrophe-fix-memory-leaks.patch
-rw-r--r--dev-libs/libstrophe/files/libstrophe-fix-crash-on-non-latin1.patch20
-rw-r--r--dev-libs/libstrophe/files/libstrophe-fix-memory-leaks.patch56
-rw-r--r--dev-libs/libstrophe/libstrophe-0.8.ebuild4
3 files changed, 79 insertions, 1 deletions
diff --git a/dev-libs/libstrophe/files/libstrophe-fix-crash-on-non-latin1.patch b/dev-libs/libstrophe/files/libstrophe-fix-crash-on-non-latin1.patch
new file mode 100644
index 0000000..41699ad
--- /dev/null
+++ b/dev-libs/libstrophe/files/libstrophe-fix-crash-on-non-latin1.patch
@@ -0,0 +1,20 @@
+diff --git a/src/hash.c b/src/hash.c
+index 27d2756..111149a 100644
+--- a/src/hash.c
++++ b/src/hash.c
+@@ -109,13 +109,13 @@ void hash_release(hash_t * const table)
+ /** hash a key for our table lookup */
+ static int _hash_key(hash_t *table, const char *key)
+ {
+- int hash = 0;
++ unsigned int hash = 0;
+ int shift = 0;
+ const char *c = key;
+
+ while (*c != '\0') {
+ /* assume 32 bit ints */
+- hash ^= ((int)*c++ << shift);
++ hash ^= ((unsigned int)*c++ << shift);
+ shift += 8;
+ if (shift > 24) shift = 0;
+ }
diff --git a/dev-libs/libstrophe/files/libstrophe-fix-memory-leaks.patch b/dev-libs/libstrophe/files/libstrophe-fix-memory-leaks.patch
new file mode 100644
index 0000000..60bb02c
--- /dev/null
+++ b/dev-libs/libstrophe/files/libstrophe-fix-memory-leaks.patch
@@ -0,0 +1,56 @@
+diff --git a/src/auth.c b/src/auth.c
+index 2371925..30d0832 100644
+--- a/src/auth.c
++++ b/src/auth.c
+@@ -554,6 +554,7 @@ static void _auth(xmpp_conn_t * const conn)
+ disconnect_mem_error(conn);
+ return;
+ }
++ xmpp_free(conn->ctx, authid);
+ xmpp_stanza_set_text(authdata, str);
+ xmpp_free(conn->ctx, str);
+
+diff --git a/src/conn.c b/src/conn.c
+index 26df418..cf29744 100644
+--- a/src/conn.c
++++ b/src/conn.c
+@@ -190,6 +190,8 @@ int xmpp_conn_release(xmpp_conn_t * const conn)
+ xmpp_connlist_t *item, *prev;
+ xmpp_handlist_t *hlitem, *thli;
+ hash_iterator_t *iter;
++ xmpp_send_queue_t *sq;
++ xmpp_send_queue_t *tsq;
+ const char *key;
+ int released = 0;
+
+@@ -267,13 +269,28 @@ int xmpp_conn_release(xmpp_conn_t * const conn)
+ }
+
+ parser_free(conn->parser);
+-
++
+ if (conn->domain) xmpp_free(ctx, conn->domain);
+ if (conn->jid) xmpp_free(ctx, conn->jid);
+- if (conn->bound_jid) xmpp_free(ctx, conn->bound_jid);
++ if (conn->bound_jid) xmpp_free(ctx, conn->bound_jid);
+ if (conn->pass) xmpp_free(ctx, conn->pass);
+ if (conn->stream_id) xmpp_free(ctx, conn->stream_id);
+ if (conn->lang) xmpp_free(ctx, conn->lang);
++
++ sq = conn->send_queue_head;
++ while (sq != NULL) {
++ if (sq->data) {
++ xmpp_free(ctx, sq->data);
++ }
++ tsq = sq->next;
++ xmpp_free(ctx, sq);
++ sq = tsq;
++ }
++
++ if (conn->tls) {
++ tls_free(conn->tls);
++ }
++
+ xmpp_free(ctx, conn);
+ released = 1;
+ }
diff --git a/dev-libs/libstrophe/libstrophe-0.8.ebuild b/dev-libs/libstrophe/libstrophe-0.8.ebuild
index c2f98e8..c172fd6 100644
--- a/dev-libs/libstrophe/libstrophe-0.8.ebuild
+++ b/dev-libs/libstrophe/libstrophe-0.8.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
@@ -25,6 +25,8 @@ S="${WORKDIR}/${P}-snapshot"
src_prepare() {
epatch "${FILESDIR}"/${PN}-xmpp-conn-disable-tls.patch
+ epatch "${FILESDIR}"/${PN}-fix-memory-leaks.patch
+ epatch "${FILESDIR}"/${PN}-fix-crash-on-non-latin1.patch
}
src_configure() {