* [PR PATCH] libstrophe: update to 0.9.3
@ 2019-11-09 15:41 voidlinux-github
2019-11-09 18:47 ` [PR PATCH] [Merged]: " voidlinux-github
0 siblings, 1 reply; 2+ messages in thread
From: voidlinux-github @ 2019-11-09 15:41 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
There is a new pull request by ndowens against master on the void-packages repository
https://github.com/ndowens/void-packages libstrophe
https://github.com/void-linux/void-packages/pull/16270
libstrophe: update to 0.9.3
Memory leak patch is now part of src,
remove un-needed patch
A patch file from https://github.com/void-linux/void-packages/pull/16270.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libstrophe-16270.patch --]
[-- Type: text/x-diff, Size: 10273 bytes --]
From cd7bc68e32cd064ece2b0204ca290feb272e55a3 Mon Sep 17 00:00:00 2001
From: Nathan Owens <ndowens04@gmail.com>
Date: Sat, 9 Nov 2019 09:35:09 -0600
Subject: [PATCH] libstrophe: update to 0.9.3
Memory leak patch is now part of src,
remove un-needed patch
---
.../patches/0001-Fix-memory-leak.patch | 242 ------------------
srcpkgs/libstrophe/template | 8 +-
2 files changed, 4 insertions(+), 246 deletions(-)
delete mode 100644 srcpkgs/libstrophe/patches/0001-Fix-memory-leak.patch
diff --git a/srcpkgs/libstrophe/patches/0001-Fix-memory-leak.patch b/srcpkgs/libstrophe/patches/0001-Fix-memory-leak.patch
deleted file mode 100644
index 05ac5194628..00000000000
--- a/srcpkgs/libstrophe/patches/0001-Fix-memory-leak.patch
+++ /dev/null
@@ -1,242 +0,0 @@
-From 9d104c0d62605ee6aaf3f13b3ad0215b1dd665f9 Mon Sep 17 00:00:00 2001
-From: Nathan Owens <ndowens04@gmail.com>
-Date: Mon, 31 Dec 2018 20:21:45 -0600
-Subject: [PATCH] Fix memory leak
-
----
- src/auth.c | 33 +++++++++++++++++++++++----------
- src/hash.c | 2 ++
- src/stanza.c | 30 +++++++++++++++++++++++-------
- tests/test_hash.c | 11 ++++++-----
- 4 files changed, 54 insertions(+), 22 deletions(-)
-
-diff --git a/src/auth.c b/src/auth.c
-index 0f09023..6872b83 100644
---- src/auth.c
-+++ src/auth.c
-@@ -219,6 +219,7 @@ static int _handle_features(xmpp_conn_t * const conn,
- void * const userdata)
- {
- xmpp_stanza_t *child, *mech;
-+ const char *ns;
- char *text;
-
- /* remove the handler that detects missing stream:features */
-@@ -228,8 +229,10 @@ static int _handle_features(xmpp_conn_t * const conn,
- if (!conn->secured) {
- if (!conn->tls_disabled) {
- child = xmpp_stanza_get_child_by_name(stanza, "starttls");
-- if (child && (strcmp(xmpp_stanza_get_ns(child), XMPP_NS_TLS) == 0))
-- conn->tls_support = 1;
-+ if (child) {
-+ ns = xmpp_stanza_get_ns(child);
-+ conn->tls_support = ns != NULL && strcmp(ns, XMPP_NS_TLS) == 0;
-+ }
- } else {
- conn->tls_support = 0;
- }
-@@ -237,11 +240,15 @@ static int _handle_features(xmpp_conn_t * const conn,
-
- /* check for SASL */
- child = xmpp_stanza_get_child_by_name(stanza, "mechanisms");
-- if (child && (strcmp(xmpp_stanza_get_ns(child), XMPP_NS_SASL) == 0)) {
-+ ns = child ? xmpp_stanza_get_ns(child) : NULL;
-+ if (child && ns && strcmp(ns, XMPP_NS_SASL) == 0) {
- for (mech = xmpp_stanza_get_children(child); mech;
- mech = xmpp_stanza_get_next(mech)) {
- if (xmpp_stanza_get_name(mech) && strcmp(xmpp_stanza_get_name(mech), "mechanism") == 0) {
- text = xmpp_stanza_get_text(mech);
-+ if (text == NULL)
-+ continue;
-+
- if (strcasecmp(text, "PLAIN") == 0)
- conn->sasl_support |= SASL_MASK_PLAIN;
- else if (strcasecmp(text, "DIGEST-MD5") == 0)
-@@ -871,7 +878,8 @@ static int _handle_features_sasl(xmpp_conn_t * const conn,
- xmpp_stanza_t * const stanza,
- void * const userdata)
- {
-- xmpp_stanza_t *bind, *session, *iq, *res, *text;
-+ xmpp_stanza_t *bind, *session, *iq, *res, *text, *opt;
-+ const char *ns;
- char *resource;
-
- /* remove missing features handler */
-@@ -880,16 +888,21 @@ static int _handle_features_sasl(xmpp_conn_t * const conn,
- /* we are expecting <bind/> and <session/> since this is a
- XMPP style connection */
-
-+ /* check whether resource binding is required */
- bind = xmpp_stanza_get_child_by_name(stanza, "bind");
-- if (bind && strcmp(xmpp_stanza_get_ns(bind), XMPP_NS_BIND) == 0) {
-- /* resource binding is required */
-- conn->bind_required = 1;
-+ if (bind) {
-+ ns = xmpp_stanza_get_ns(bind);
-+ conn->bind_required = ns != NULL && strcmp(ns, XMPP_NS_BIND) == 0;
- }
-
-+ /* check whether session establishment is required */
- session = xmpp_stanza_get_child_by_name(stanza, "session");
-- if (session && strcmp(xmpp_stanza_get_ns(session), XMPP_NS_SESSION) == 0) {
-- /* session establishment required */
-- conn->session_required = 1;
-+ if (session) {
-+ ns = xmpp_stanza_get_ns(session);
-+ opt = xmpp_stanza_get_child_by_name(session, "optional");
-+ if (!opt)
-+ conn->session_required = ns != NULL &&
-+ strcmp(ns, XMPP_NS_SESSION) == 0;
- }
-
- /* if bind is required, go ahead and start it */
-diff --git a/src/hash.c b/src/hash.c
-index a524f5b..dc9dd2c 100644
---- src/hash.c
-+++ src/hash.c
-@@ -163,6 +163,8 @@ int hash_add(hash_t *table, const char * const key, void *data)
- entry->next = table->entries[table_index];
- table->entries[table_index] = entry;
- table->num_keys++;
-+ } else {
-+ if (table->free) table->free(ctx, entry->value);
- }
-
- entry->value = data;
-diff --git a/src/stanza.c b/src/stanza.c
-index 8e45f23..32584d4 100644
---- src/stanza.c
-+++ src/stanza.c
-@@ -344,10 +344,16 @@ static int _render_stanza_recursive(xmpp_stanza_t *stanza,
- }
- tmp = _escape_xml(stanza->ctx,
- (char *)hash_get(stanza->attributes, key));
-- if (tmp == NULL) return XMPP_EMEM;
-+ if (tmp == NULL) {
-+ hash_iter_release(iter);
-+ return XMPP_EMEM;
-+ }
- ret = xmpp_snprintf(ptr, left, " %s=\"%s\"", key, tmp);
- xmpp_free(stanza->ctx, tmp);
-- if (ret < 0) return XMPP_EMEM;
-+ if (ret < 0) {
-+ hash_iter_release(iter);
-+ return XMPP_EMEM;
-+ }
- _render_update(&written, buflen, ret, &left, &ptr);
- }
- hash_iter_release(iter);
-@@ -421,7 +427,12 @@ int xmpp_stanza_to_text(xmpp_stanza_t *stanza,
- }
-
- ret = _render_stanza_recursive(stanza, buffer, length);
-- if (ret < 0) return ret;
-+ if (ret < 0) {
-+ xmpp_free(stanza->ctx, buffer);
-+ *buf = NULL;
-+ *buflen = 0;
-+ return ret;
-+ }
-
- if ((size_t)ret > length - 1) {
- tmp = xmpp_realloc(stanza->ctx, buffer, ret + 1);
-@@ -435,7 +446,12 @@ int xmpp_stanza_to_text(xmpp_stanza_t *stanza,
- buffer = tmp;
-
- ret = _render_stanza_recursive(stanza, buffer, length);
-- if ((size_t)ret > length - 1) return XMPP_EMEM;
-+ if ((size_t)ret > length - 1) {
-+ xmpp_free(stanza->ctx, buffer);
-+ *buf = NULL;
-+ *buflen = 0;
-+ return XMPP_EMEM;
-+ }
- }
-
- buffer[length - 1] = 0;
-@@ -573,7 +589,6 @@ int xmpp_stanza_set_attribute(xmpp_stanza_t * const stanza,
-
- val = xmpp_strdup(stanza->ctx, value);
- if (!val) {
-- hash_release(stanza->attributes);
- return XMPP_EMEM;
- }
-
-@@ -809,10 +824,11 @@ xmpp_stanza_t *xmpp_stanza_get_child_by_ns(xmpp_stanza_t * const stanza,
- const char * const ns)
- {
- xmpp_stanza_t *child;
-+ const char *child_ns;
-
- for (child = stanza->children; child; child = child->next) {
-- if (xmpp_stanza_get_ns(child) &&
-- strcmp(ns, xmpp_stanza_get_ns(child)) == 0)
-+ child_ns = xmpp_stanza_get_ns(child);
-+ if (child_ns && strcmp(ns, child_ns) == 0)
- break;
- }
-
-diff --git a/tests/test_hash.c b/tests/test_hash.c
-index 6910794..d9f95f8 100644
---- tests/test_hash.c
-+++ tests/test_hash.c
-@@ -16,18 +16,19 @@
- #include "strophe.h"
- #include "common.h"
- #include "hash.h"
-+#include "test.h"
-
- #define TABLESIZE 100
- #define TESTSIZE 500
-
- /* static test data */
--const int nkeys = 5;
- const char *keys[] = {
- "foo", "bar", "baz", "quux", "xyzzy"
- };
- const char *values[] = {
- "wuzzle", "mug", "canonical", "rosebud", "lottery"
- };
-+const int nkeys = ARRAY_SIZE(keys);
-
- int main(int argc, char **argv)
- {
-@@ -58,7 +59,7 @@ int main(int argc, char **argv)
- }
-
- /* allocate a hash table */
-- table = hash_new(ctx, TABLESIZE, NULL);
-+ table = hash_new(ctx, TABLESIZE, xmpp_free);
- if (table == NULL) {
- /* table allocation failed! */
- return 1;
-@@ -66,7 +67,7 @@ int main(int argc, char **argv)
-
- /* test insertion */
- for (i = 0; i < nkeys; i++) {
-- err = hash_add(table, keys[i], (void*)values[i]);
-+ err = hash_add(table, keys[i], xmpp_strdup(ctx, values[i]));
- if (err) return err;
- }
-
-@@ -78,7 +79,7 @@ int main(int argc, char **argv)
-
- /* test replacing old values */
- for (i = 0; i < nkeys; i++) {
-- err = hash_add(table, keys[0], (void*)values[i]);
-+ err = hash_add(table, keys[0], xmpp_strdup(ctx, values[i]));
- if (err) return err;
- if (hash_num_keys(table) != nkeys) return 1;
- result = hash_get(table, keys[0]);
-@@ -86,7 +87,7 @@ int main(int argc, char **argv)
- if (strcmp(result, values[i]) != 0) return 1;
- }
- /* restore value for the 1st key */
-- hash_add(table, keys[0], (void*)values[0]);
-+ hash_add(table, keys[0], xmpp_strdup(ctx, values[0]));
-
- /* test cloning */
- clone = hash_clone(table);
---
-2.20.1
-
diff --git a/srcpkgs/libstrophe/template b/srcpkgs/libstrophe/template
index 50511d31f5d..1b91eae5da4 100644
--- a/srcpkgs/libstrophe/template
+++ b/srcpkgs/libstrophe/template
@@ -1,16 +1,16 @@
# Template file for 'libstrophe'
pkgname=libstrophe
-version=0.9.2
-revision=6
+version=0.9.3
+revision=1
build_style=gnu-configure
hostmakedepends="automake libtool pkg-config"
makedepends="expat-devel libressl-devel zlib-devel"
-short_desc="A minimal XMPP library written in C"
+short_desc="Minimal XMPP library written in C"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-3.0-only"
homepage="http://strophe.im/libstrophe/"
distfiles="https://github.com/strophe/libstrophe/archive/${version}.tar.gz"
-checksum=158145bc1565a5fd0bbd7f57e3e15d768e58b8a460897ab5918a5a689d67ae6f
+checksum=8a3b79f62177ed59c01d4d4108357ff20bd933d53b845ee4e350d304c051a4fe
pre_configure() {
NOCONFIGURE=1 ./bootstrap.sh
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PR PATCH] [Merged]: libstrophe: update to 0.9.3
2019-11-09 15:41 [PR PATCH] libstrophe: update to 0.9.3 voidlinux-github
@ 2019-11-09 18:47 ` voidlinux-github
0 siblings, 0 replies; 2+ messages in thread
From: voidlinux-github @ 2019-11-09 18:47 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 222 bytes --]
There's a merged pull request on the void-packages repository
libstrophe: update to 0.9.3
https://github.com/void-linux/void-packages/pull/16270
Description:
Memory leak patch is now part of src,
remove un-needed patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-09 18:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-09 15:41 [PR PATCH] libstrophe: update to 0.9.3 voidlinux-github
2019-11-09 18:47 ` [PR PATCH] [Merged]: " voidlinux-github
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).