Merge pull request #2960 from orestisf1993/next

Fix possible errors related to free()
This commit is contained in:
Ingo Bürk 2017-09-17 12:05:04 +02:00 committed by GitHub
commit d726d09d49
3 changed files with 3 additions and 3 deletions

View File

@ -1048,8 +1048,8 @@ void randr_init(int *event_base, const bool disable_randr15) {
xcb_randr_query_version_reply(
conn, xcb_randr_query_version(conn, XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION), &err);
if (err != NULL) {
free(err);
ELOG("Could not query RandR version: X11 error code %d\n", err->error_code);
free(err);
fallback_to_root_output();
return;
}

View File

@ -66,13 +66,13 @@ static Con *_create___i3(void) {
bool tree_restore(const char *path, xcb_get_geometry_reply_t *geometry) {
bool result = false;
char *globbed = resolve_tilde(path);
char *buf = NULL;
if (!path_exists(globbed)) {
LOG("%s does not exist, not restoring tree\n", globbed);
goto out;
}
char *buf = NULL;
ssize_t len;
if ((len = slurp(globbed, &buf)) < 0) {
/* slurp already logged an error. */

View File

@ -501,7 +501,7 @@ ssize_t slurp(const char *path, char **buf) {
fclose(f);
if ((ssize_t)n != stbuf.st_size) {
ELOG("File \"%s\" could not be read entirely: got %zd, want %zd\n", path, n, stbuf.st_size);
free(buf);
free(*buf);
*buf = NULL;
return -1;
}