virBufferEscapeString(virBufferPtr buf, const char *format, const char *str)
{
int len;
- char *escaped, *out;
+ VIR_AUTOFREE(char *) escaped = NULL;
+ char *out;
const char *cur;
const char forbidden_characters[] = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
*out = 0;
virBufferAsprintf(buf, format, escaped);
- VIR_FREE(escaped);
}
/**
const char *format, const char *str)
{
int len;
- char *escaped, *out;
+ VIR_AUTOFREE(char *) escaped = NULL;
+ char *out;
const char *cur;
if ((format == NULL) || (buf == NULL) || (str == NULL))
*out = 0;
virBufferAsprintf(buf, format, escaped);
- VIR_FREE(escaped);
}
{
int len;
size_t i;
- char *escaped = NULL;
+ VIR_AUTOFREE(char *) escaped = NULL;
char *out;
const char *cur;
virBufferEscapePair escapeItem;
cleanup:
va_end(ap);
VIR_FREE(escapeList);
- VIR_FREE(escaped);
}
virBufferEscapeShell(virBufferPtr buf, const char *str)
{
int len;
- char *escaped, *out;
+ VIR_AUTOFREE(char *) escaped = NULL;
+ char *out;
const char *cur;
if ((buf == NULL) || (str == NULL))
*out = 0;
virBufferAdd(buf, escaped, -1);
- VIR_FREE(escaped);
}
/**