qrexec-lib: fix memory leak

If xs_read returns pointer to empty string (len==0), then it was leaked.
This commit is contained in:
Marek Marczykowski-Górecki 2013-10-27 16:05:32 +01:00
parent c3ef1acb1a
commit 2739340559

View File

@ -199,9 +199,10 @@ char *peer_client_init(int dom, int port)
free(vec); free(vec);
len = 0; len = 0;
dummy = xs_read(xs, 0, devbuf, &len); dummy = xs_read(xs, 0, devbuf, &len);
if (dummy)
free(dummy);
} }
while (!dummy || !len); // wait for the server to create xenstore entries while (!dummy || !len); // wait for the server to create xenstore entries
free(dummy);
xs_daemon_close(xs); xs_daemon_close(xs);
// now client init should succeed; "while" is redundant // now client init should succeed; "while" is redundant