diff options
author | Jim Meyering <meyering@redhat.com> | 2009-08-12 14:44:14 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-08-12 15:47:08 +0200 |
commit | bf76b637d25fb70f0320caa63e264104112feaab (patch) | |
tree | 30efd5e5a17286ac364c68ffadb71b319c8ecd42 /fish | |
parent | f1d23409f7297c8435c939b919fe5c2331fd484e (diff) | |
download | libguestfs-bf76b637d25fb70f0320caa63e264104112feaab.tar.gz libguestfs-bf76b637d25fb70f0320caa63e264104112feaab.tar.xz libguestfs-bf76b637d25fb70f0320caa63e264104112feaab.zip |
fish: don't read freed memory
* fish/rc.c (rc_remote): Close file handle only *after* xdr_destroy,
because that latter may flush its file handle (implicated via
xdrstdio_create). FYI, this failure is triggered for me only when
MALLOC_PERTURB_ is set to nonzero < 256 in my environment.
Diffstat (limited to 'fish')
-rw-r--r-- | fish/rc.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -235,8 +235,8 @@ rc_remote (int pid, const char *cmd, int argc, char *argv[], if (!xdr_guestfish_hello (&xdr, &hello)) { fprintf (stderr, _("guestfish: protocol error: could not send initial greeting to server\n")); - fclose (fp); xdr_destroy (&xdr); + fclose (fp); return -1; } @@ -249,8 +249,8 @@ rc_remote (int pid, const char *cmd, int argc, char *argv[], call.exit_on_error = exit_on_error; if (!xdr_guestfish_call (&xdr, &call)) { fprintf (stderr, _("guestfish: protocol error: could not send initial greeting to server\n")); - fclose (fp); xdr_destroy (&xdr); + fclose (fp); return -1; } xdr_destroy (&xdr); @@ -260,13 +260,13 @@ rc_remote (int pid, const char *cmd, int argc, char *argv[], if (!xdr_guestfish_reply (&xdr, &reply)) { fprintf (stderr, _("guestfish: protocol error: could not decode reply from server\n")); - fclose (fp); xdr_destroy (&xdr); + fclose (fp); return -1; } - fclose (fp); xdr_destroy (&xdr); + fclose (fp); return reply.r; } |