This is an automated email from the git hooks/post-receive script.
rharwood pushed a commit to branch master in repository gssproxy.
commit f2530fc280dd84e6abc0f5475e261aa0d2ee2a21 Author: Alexander Scheel alexander.m.scheel@gmail.com Date: Thu Sep 14 11:24:39 2017 -0500
Fix error handling in gpm_send_buffer/gpm_recv_buffer
Signed-off-by: Alexander Scheel alexander.m.scheel@gmail.com Reviewed-by: Robbie Harwood rharwood@redhat.com Merges: #213 [rharwood@redhat.com: commit message formatting, copyright update] --- proxy/src/client/gpm_common.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/proxy/src/client/gpm_common.c b/proxy/src/client/gpm_common.c index 6d93a55..75c64d7 100644 --- a/proxy/src/client/gpm_common.c +++ b/proxy/src/client/gpm_common.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 the GSS-PROXY contributors, see COPYING for license */ +/* Copyright (C) 2011,2017 the GSS-PROXY contributors, see COPYING for license */
#include "gssapi_gpm.h" #include <sys/types.h> @@ -419,10 +419,7 @@ static int gpm_send_buffer(struct gpm_ctx *gpmctx, ret = 0;
done: - if (ret) { - /* on errors we can only close the fd and return */ - gpm_close_socket(gpmctx); - } + /* we only need to return as gpm_retry_socket closes the socket */ return ret; }
@@ -492,9 +489,10 @@ static int gpm_recv_buffer(struct gpm_ctx *gpmctx,
done: if (ret) { - /* on errors we can only close the fd and return */ - gpm_close_socket(gpmctx); - gpm_epoll_close(gpmctx); + /* on errors, free the buffer to prevent calling + * xdr_destroy(&xdr_reply_ctx); */ + free(*buffer); + *buffer = NULL; } return ret; } @@ -569,10 +567,6 @@ static int gpm_send_recv_loop(struct gpm_ctx *gpmctx, char *send_buffer, /* Close and reopen socket before trying again */ ret = gpm_retry_socket(gpmctx);
- /* Free buffer and set it to NULL to prevent free(xdr_reply_ctx) */ - free(*recv_buffer); - *recv_buffer = NULL; - if (ret != 0) return ret; ret = ETIMEDOUT;