if (streq(init_path, "/"))
init_path[0] = 0;
- if (startswith(process_path, init_path))
- path = process_path + strlen(init_path);
- else
+ if (startswith(process_path, init_path)) {
+ char *p;
+
+ p = strdup(process_path + strlen(init_path));
+ if (!p) {
+ free(process_path);
+ free(init_path);
+ return NULL;
+ }
+ path = p;
+ } else {
path = process_path;
+ process_path = NULL;
+ }
+ free(process_path);
free(init_path);
return path;
struct timeval *tv,
int priority) {
int rl;
- char *path, *c;
+ char *path = NULL, *c;
assert(s);
assert(iovec || n == 0);
if (s->rate_limit)
journal_rate_limit_free(s->rate_limit);
+
+ free(s->buffer);
}
int main(int argc, char *argv[]) {