1. Plugs a memory leak in file_to_string(). If we failed to open the
file, we were returning without freeing the growing_buffer that held
the file name.
2. Replaces a couple of calls to buffer_data() with calls to
buffer_release().
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1195
9efc2488-bf62-4759-914b-
345cdb29e865
idx++;
}
- char* d = buffer_data(buf);
- buffer_free(buf);
- return d;
+ return buffer_release(buf);
}
FILE* file = fopen(filename, "r");
if(!file) {
osrfLogError( OSRF_LOG_MARK, "Unable to open file [%s]", filename );
+ buffer_free(gb);
return NULL;
}
fclose(file);
- char* data = buffer_data(gb);
- buffer_free(gb);
- return data;
+ return buffer_release(gb);
}