mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05: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
@ -87,11 +87,13 @@ static char *expando_cumode(SERVER_REC *server, void *item, int *free_ret)
|
|||||||
{
|
{
|
||||||
if (IS_IRC_CHANNEL(item) && CHANNEL(item)->ownnick) {
|
if (IS_IRC_CHANNEL(item) && CHANNEL(item)->ownnick) {
|
||||||
char prefix = NICK(CHANNEL(item)->ownnick)->prefixes[0];
|
char prefix = NICK(CHANNEL(item)->ownnick)->prefixes[0];
|
||||||
char *cumode = g_malloc(2);
|
if (prefix != '\0') {
|
||||||
cumode[0] = prefix;
|
char *cumode = g_malloc(2);
|
||||||
cumode[1] = '\0';
|
cumode[0] = prefix;
|
||||||
*free_ret = TRUE;
|
cumode[1] = '\0';
|
||||||
return cumode; /* will be "\0\0" = "" if there is no prefix */
|
*free_ret = TRUE;
|
||||||
|
return cumode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user