Skip to content

Commit

Permalink
bkpr: cleanup csv_safe_str
Browse files Browse the repository at this point in the history
  • Loading branch information
niftynei authored and rustyrussell committed Jul 28, 2022
1 parent c83c152 commit 6e9af1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ccan/ccan/tal/tal.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ void *tal_dup_(const tal_t *ctx, const void *p, size_t size,
(void)taken(p);
return NULL;
}

if (!adjust_size(&nbytes, n)) {
if (taken(p))
tal_free(p);
Expand Down
4 changes: 2 additions & 2 deletions plugins/bkpr/incomestmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ static char *csv_safe_str(const tal_t *ctx, char *input TAKES)
char *dupe;

/* Update the double-quotes in place */
dupe = tal_strdup(ctx, input);
dupe = tal_strdup(tmpctx, input);
for (size_t i = 0; dupe[i] != '\0'; i++) {
if (dupe[i] == '"')
dupe[i] = '\'';
}

esc = json_escape(ctx, dupe);
esc = json_escape(tmpctx, take(dupe));
return tal_fmt(ctx, "\"%s\"", esc->s);
}

Expand Down

0 comments on commit 6e9af1e

Please sign in to comment.