(_krb5_expand_default_cc_name): just copy the string instead of losing const
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15445 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -260,17 +260,17 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res)
|
|||||||
(int)(tmp2 - tmp) - 2, tmp + 2);
|
(int)(tmp2 - tmp) - 2, tmp + 2);
|
||||||
return KRB5_CONFIG_BADFORMAT;
|
return KRB5_CONFIG_BADFORMAT;
|
||||||
}
|
}
|
||||||
if (append == NULL) {
|
|
||||||
free(*res);
|
|
||||||
res = NULL;
|
|
||||||
krb5_set_error_string(context, "malloc - out of memory");
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
str = tmp2 + 1;
|
str = tmp2 + 1;
|
||||||
} else {
|
} else {
|
||||||
append = (char *)str;
|
append = strdup(str);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
}
|
}
|
||||||
|
if (append == NULL) {
|
||||||
|
free(*res);
|
||||||
|
res = NULL;
|
||||||
|
krb5_set_error_string(context, "malloc - out of memory");
|
||||||
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
tlen = strlen(append);
|
tlen = strlen(append);
|
||||||
tmp = realloc(*res, len + tlen + 1);
|
tmp = realloc(*res, len + tlen + 1);
|
||||||
@@ -283,8 +283,7 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res)
|
|||||||
*res = tmp;
|
*res = tmp;
|
||||||
memcpy(*res + len, append, tlen + 1);
|
memcpy(*res + len, append, tlen + 1);
|
||||||
len = len + tlen;
|
len = len + tlen;
|
||||||
if (str)
|
free(append);
|
||||||
free(append);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user