mirror of
https://github.com/irssi/irssi.git
synced 2026-08-09 03:40:16 +02:00
Ensure that expando_cumode_space() doesn't free unallocated memory when no
prefix exists by conditionally allocating and marking to-be-freed the cumode string inside of expando_cumode(). (Bug #669) git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5203 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
2bee6f12ae
commit
444b42bf3e
1 changed files with 7 additions and 5 deletions
|
|
@ -87,11 +87,13 @@ static char *expando_cumode(SERVER_REC *server, void *item, int *free_ret)
|
|||
{
|
||||
if (IS_IRC_CHANNEL(item) && CHANNEL(item)->ownnick) {
|
||||
char prefix = NICK(CHANNEL(item)->ownnick)->prefixes[0];
|
||||
char *cumode = g_malloc(2);
|
||||
cumode[0] = prefix;
|
||||
cumode[1] = '\0';
|
||||
*free_ret = TRUE;
|
||||
return cumode; /* will be "\0\0" = "" if there is no prefix */
|
||||
if (prefix != '\0') {
|
||||
char *cumode = g_malloc(2);
|
||||
cumode[0] = prefix;
|
||||
cumode[1] = '\0';
|
||||
*free_ret = TRUE;
|
||||
return cumode;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue