1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

Do not hide deallocation of buffer

As API is passing structures by value, do not leave
the function which created buffer and keeps valid pointer
look like it would be some memory leak and move
free of buffer from inner function - makes more obvious,
how is the memory management handled.
This commit is contained in:
Zdenek Kabelac 2012-02-27 11:49:16 +00:00
parent c57a9960b5
commit 5627fc8e7b

View File

@ -62,8 +62,6 @@ daemon_reply daemon_send(daemon_handle h, daemon_request rq)
if (!write_buffer(h.socket_fd, rq.buffer, strlen(rq.buffer)))
reply.error = errno;
dm_free(rq.buffer);
if (read_buffer(h.socket_fd, &reply.buffer)) {
reply.cft = dm_config_from_string(reply.buffer);
} else
@ -93,6 +91,8 @@ daemon_reply daemon_send_simple(daemon_handle h, const char *id, ...)
return err;
repl = daemon_send(h, rq);
dm_free(rq.buffer);
return repl;
}