Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
#endif /* PAKFIRE_DEBUG_PARSER */
// Replace all occurrences
- char* tmp = pakfire_string_replace(*buffer, (const char*)pattern, (repl) ? repl : "");
- if (!tmp)
+ char* tmp = pakfire_string_replace(*buffer, (const char*)pattern, repl);
+ if (!tmp) {
+ r = -errno;
goto ERROR;
+ }
// Replace buffer
free(*buffer);
*buffer = tmp;
// Free resources
- if (variable)
+ if (variable) {
pcre2_substring_free(variable);
- variable = NULL;
-
- if (pattern)
+ variable = NULL;
+ }
+ if (pattern) {
pcre2_substring_free(pattern);
- pattern = NULL;
+ pattern = NULL;
+ }
}
ERROR: