removed trailing whitespace, free a missing malloc when returning error
This commit is contained in:
parent
4af08a19f8
commit
6c3759d78d
@ -296,36 +296,38 @@ Curl_sec_putc(struct connectdata *conn, int c, FILE *F)
|
||||
int
|
||||
Curl_sec_read_msg(struct connectdata *conn, char *s, int level)
|
||||
{
|
||||
int len;
|
||||
char *buf;
|
||||
int code;
|
||||
int len;
|
||||
char *buf;
|
||||
int code;
|
||||
|
||||
buf = malloc(strlen(s));
|
||||
len = Curl_base64_decode(s + 4, buf); /* XXX */
|
||||
buf = malloc(strlen(s));
|
||||
len = Curl_base64_decode(s + 4, buf); /* XXX */
|
||||
|
||||
len = (conn->mech->decode)(conn->app_data, buf, len, level, conn);
|
||||
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);
|
||||
len = (conn->mech->decode)(conn->app_data, buf, len, level, conn);
|
||||
if(len < 0) {
|
||||
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
|
||||
Curl_set_command_prot(struct connectdata *conn, enum protection_level level)
|
||||
{
|
||||
enum protection_level old = conn->command_prot;
|
||||
conn->command_prot = level;
|
||||
return old;
|
||||
enum protection_level old = conn->command_prot;
|
||||
conn->command_prot = level;
|
||||
return old;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
x
Reference in New Issue
Block a user