[Pkg-privacy-commits] [irssi-plugin-otr] 167/267: Fix: some utils missing check and string fix
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:26:29 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 cdf22ef673681eae74bc040c6442f88d3f7bf18f
Author: David Goulet <dgoulet at ev0ke.net>
Date: Sat Dec 1 22:37:48 2012 -0500
Fix: some utils missing check and string fix
Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
src/utils.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/utils.c b/src/utils.c
index deca84c..06ddab7 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -157,13 +157,14 @@ error:
*/
int utils_auth_extract_secret(const char *_data, char **secret)
{
- char *s, *data = NULL, *cmd_offset = NULL;
+ int ret = -1;
+ char *s, *cmd_offset = NULL, *data = NULL;
if (!_data || !secret) {
goto error;
}
- data = strndup(_data, strlen(_data));
+ data = strdup(_data);
if (!data) {
goto error;
}
@@ -176,13 +177,14 @@ int utils_auth_extract_secret(const char *_data, char **secret)
}
s = utils_trim_string(cmd_offset);
- *secret = s;
- return 0;
+ *secret = strdup(s);
+
+ ret = 0;
error:
free(data);
- return -1;
+ return ret;
}
/*
@@ -266,6 +268,11 @@ void utils_free_args(char ***argv, int argc)
assert(argv);
+ /* Nothing to free. */
+ if (argc == 0) {
+ return;
+ }
+
args = *argv;
for (i = 0; i < argc; i++) {
--
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