Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
{
char path[100], *space;
int ret;
- char *buf = NULL;
+ char *buf = NULL, *newbuf;
int sz = 0;
FILE *f;
return NULL;
}
sz += 1024;
- buf = realloc(buf, sz);
- if (!buf) {
+ newbuf = realloc(buf, sz);
+ if (!newbuf) {
+ free(buf);
ERROR("out of memory");
process_lock();
fclose(f);
process_unlock();
return NULL;
}
+ buf = newbuf;
memset(buf, 0, sz);
ret = fread(buf, 1, sz - 1, f);
process_lock();