mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Replace a `goto out' with explicit freeing
This commit is contained in:
parent
7bfe3a8fa1
commit
ff08b3b022
@ -87,7 +87,7 @@ static char **split_line(const SERVER_REC *server, const char *line,
|
|||||||
const char *end = settings_get_str("split_line_end");
|
const char *end = settings_get_str("split_line_end");
|
||||||
char *recoded_start = recode_out(server, start, target);
|
char *recoded_start = recode_out(server, start, target);
|
||||||
char *recoded_end = recode_out(server, end, target);
|
char *recoded_end = recode_out(server, end, target);
|
||||||
char **lines = NULL;
|
char **lines;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -96,8 +96,12 @@ static char **split_line(const SERVER_REC *server, const char *line,
|
|||||||
* the code much simpler. It's worth it.
|
* the code much simpler. It's worth it.
|
||||||
*/
|
*/
|
||||||
len -= strlen(recoded_start) + strlen(recoded_end);
|
len -= strlen(recoded_start) + strlen(recoded_end);
|
||||||
if (len <= 0)
|
if (len <= 0) {
|
||||||
goto out; /* There is no room for anything. */
|
/* There is no room for anything. */
|
||||||
|
g_free(recoded_start);
|
||||||
|
g_free(recoded_end);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
lines = recode_split(server, line, target, len);
|
lines = recode_split(server, line, target, len);
|
||||||
for (i = 0; lines[i] != NULL; i++) {
|
for (i = 0; lines[i] != NULL; i++) {
|
||||||
@ -137,7 +141,6 @@ static char **split_line(const SERVER_REC *server, const char *line,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
g_free(recoded_start);
|
g_free(recoded_start);
|
||||||
g_free(recoded_end);
|
g_free(recoded_end);
|
||||||
return lines;
|
return lines;
|
||||||
|
Loading…
Reference in New Issue
Block a user