Permalink
Browse files

dev-libs/libstrophe: added 2 patches

libstrophe-fix-crash-on-non-latin1.patch
libstrophe-fix-memory-leaks.patch
  • Loading branch information...
pasis committed Mar 20, 2013
1 parent bfecaec commit c1fd94d9c54243227ef8ae35d447dfceb38ec4c4
@@ -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;
+ }
@@ -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;
+ }
@@ -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() {

0 comments on commit c1fd94d

Please sign in to comment.