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
1 changed files with 40 additions and 38 deletions

View File

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