[Pkg-privacy-commits] [irssi-plugin-otr] 192/267: Fix: memory leak on error path

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 a8ae7695cbd4caa0f6e34d8ce2b1edc07409262a
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Fri Feb 1 17:34:43 2013 -0500

    Fix: memory leak on error path
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/utils.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/utils.c b/src/utils.c
index 8f82e63..ceae3e9 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -83,7 +83,7 @@ int utils_io_extract_smp(const char *data, char **question, char **secret)
 {
 	unsigned int q_len, s_len;
 	const char *tmp, *q_end, *q_beg, *args = data;
-	char *q, *s;
+	char *q = NULL, *s = NULL;
 
 	if (!data || !question || !secret) {
 		goto error;
@@ -140,7 +140,6 @@ int utils_io_extract_smp(const char *data, char **question, char **secret)
 
 	s = malloc((s_len + 1) * sizeof(char));
 	if (s == NULL) {
-		free(q);
 		goto error;
 	}
 
@@ -153,6 +152,8 @@ int utils_io_extract_smp(const char *data, char **question, char **secret)
 	return 0;
 
 error:
+	free(q);
+	free(s);
 	return -1;
 }
 

-- 
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