forked from PsychoticNinja/irssi
Always use g_realloc rather than using g_malloc when the pointer
is NULL. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4794 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
d39d949b79
commit
e8ae6d827d
@ -43,8 +43,7 @@ static void linebuf_append(LINEBUF_REC *rec, const char *data, int len)
|
|||||||
{
|
{
|
||||||
if (rec->len+len > rec->alloc) {
|
if (rec->len+len > rec->alloc) {
|
||||||
rec->alloc = nearest_power(rec->len+len);;
|
rec->alloc = nearest_power(rec->len+len);;
|
||||||
rec->str = rec->str == NULL ? g_malloc(rec->alloc) :
|
rec->str = g_realloc(rec->str, rec->alloc);
|
||||||
g_realloc(rec->str, rec->alloc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(rec->str + rec->len, data, len);
|
memcpy(rec->str + rec->len, data, len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user