[titlebar] Fix buffer allocation
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
b348af16e2
commit
16d98db666
|
@ -38,10 +38,9 @@ titlebar_markup_parse(client_t *c, const char *str, ssize_t len)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
ssize_t clen;
|
ssize_t clen;
|
||||||
|
|
||||||
new = p_new(char, len++);
|
new = p_new(char, ++len);
|
||||||
|
|
||||||
for(ps = str; *ps; ps++, i++)
|
for(ps = str; *ps; ps++, i++)
|
||||||
{
|
|
||||||
if(*ps == '%')
|
if(*ps == '%')
|
||||||
{
|
{
|
||||||
ps++;
|
ps++;
|
||||||
|
@ -58,7 +57,6 @@ titlebar_markup_parse(client_t *c, const char *str, ssize_t len)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
new[i] = *ps;
|
new[i] = *ps;
|
||||||
}
|
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue