[Pkg-privacy-commits] [irssi-plugin-otr] 195/267: Fix: explicitly set ptr to NULL on asprintf error
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:26:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository irssi-plugin-otr.
commit 59ddcbe66afe35a90c3fd164b4f9a53e4208ef26
Author: David Goulet <dgoulet at ev0ke.net>
Date: Mon Mar 25 21:36:01 2013 -0400
Fix: explicitly set ptr to NULL on asprintf error
Fixes #27
Reported-by: George Kadianakis <desnacked at riseup.ne>
Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
src/otr.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/otr.c b/src/otr.c
index 0028d7a..840c1b3 100644
--- a/src/otr.c
+++ b/src/otr.c
@@ -57,7 +57,7 @@ static guint otr_timerid;
static char *create_account_name(SERVER_REC *irssi)
{
int ret;
- char *accname = NULL;
+ char *accname;
assert(irssi);
@@ -66,6 +66,11 @@ static char *create_account_name(SERVER_REC *irssi)
IRSSI_CONN_ADDR(irssi));
if (ret < 0) {
IRSSI_INFO(NULL, NULL, "Unable to allocate account name.");
+ /*
+ * As stated in asprintf(3), if an error occurs, the contents of the
+ * passed pointer is undefined. Force it to NULL here.
+ */
+ accname = NULL;
}
return accname;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/irssi-plugin-otr.git
More information about the Pkg-privacy-commits
mailing list