1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

removed trailing whitespace, free a missing malloc when returning error

This commit is contained in:
Daniel Stenberg 2004-06-30 11:51:24 +00:00
parent 4af08a19f8
commit 6c3759d78d

View File

@ -296,36 +296,38 @@ Curl_sec_putc(struct connectdata *conn, int c, FILE *F)
int int
Curl_sec_read_msg(struct connectdata *conn, char *s, int level) Curl_sec_read_msg(struct connectdata *conn, char *s, int level)
{ {
int len; int len;
char *buf; char *buf;
int code; int code;
buf = malloc(strlen(s)); buf = malloc(strlen(s));
len = Curl_base64_decode(s + 4, buf); /* XXX */ len = Curl_base64_decode(s + 4, buf); /* XXX */
len = (conn->mech->decode)(conn->app_data, buf, len, level, conn); len = (conn->mech->decode)(conn->app_data, buf, len, level, conn);
if(len < 0) if(len < 0) {
return -1;
buf[len] = '\0';
if(buf[3] == '-')
code = 0;
else
sscanf(buf, "%d", &code);
if(buf[len-1] == '\n')
buf[len-1] = '\0';
strcpy(s, buf);
free(buf); free(buf);
return code; return -1;
}
buf[len] = '\0';
if(buf[3] == '-')
code = 0;
else
sscanf(buf, "%d", &code);
if(buf[len-1] == '\n')
buf[len-1] = '\0';
strcpy(s, buf);
free(buf);
return code;
} }
enum protection_level enum protection_level
Curl_set_command_prot(struct connectdata *conn, enum protection_level level) Curl_set_command_prot(struct connectdata *conn, enum protection_level level)
{ {
enum protection_level old = conn->command_prot; enum protection_level old = conn->command_prot;
conn->command_prot = level; conn->command_prot = level;
return old; return old;
} }
static int static int