node->type = XLAT_REGEX;
*head = node;
- node->len = (q - start) + 1;
- goto finish;
+ node->len = (q - start);
+ MEM(start = talloc_realloc_bstr(start, node->len));
+ q++; /* Skip closing brace */
+
+ return 2 + (q - start);
}
#endif /* HAVE_REGEX */
rad_assert(node->next == NULL);
node->len = p - start;
- goto finish;
+ MEM(start = talloc_realloc_bstr(start, node->len));
+
+ return 2 + node->len;
}
*q = ':'; /* Avoids a talloc_strdup */
}
q++;
node->len = (q - start);
- goto finish;
+ MEM(start = talloc_realloc_bstr(start, node->len));
+
+ return 2 + node->len;
}
talloc_free(node);
*error = "No matching closing brace";
return -1; /* error @ second character of format string */
}
- p++;
node->len = (p - start);
node->async_safe = true; /* attribute expansions are always async-safe */
/*
* Shrink the buffer to the right size
*/
-finish:
MEM(start = talloc_realloc_bstr(start, node->len));
+ p++;
- return 2 + node->len;
+ return 2 + (p - start);
}