diff mbox series

Remove unneded setting of errno after malloc failure

Message ID mvm36yqxv4k.fsf@suse.de
State New
Headers show
Series Remove unneded setting of errno after malloc failure | expand

Commit Message

Andreas Schwab May 17, 2018, 1:35 p.m. UTC
The errno value has alread been set by malloc.

	* resolv/res_send.c (__res_context_send): Don't set errno when
	returning error after malloc failure.
---
 resolv/res_send.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

H.J. Lu May 17, 2018, 1:38 p.m. UTC | #1
On Thu, May 17, 2018 at 6:35 AM, Andreas Schwab <schwab@suse.de> wrote:
> The errno value has alread been set by malloc.
>
>         * resolv/res_send.c (__res_context_send): Don't set errno when
>         returning error after malloc failure.
> ---
>  resolv/res_send.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/resolv/res_send.c b/resolv/res_send.c
> index 9e9541789b..947ebf5212 100644
> --- a/resolv/res_send.c
> +++ b/resolv/res_send.c
> @@ -472,10 +472,7 @@ __res_context_send (struct resolv_context *ctx,
>                                         sizeof (struct sockaddr_in6)
>                                         - sizeof (struct sockaddr_in));
>                         else
> -                         {
> -                           __set_errno (ENOMEM);
> -                           return -1;
> -                         }
> +                               return -1;
>                 }
>                 EXT(statp).nscount = statp->nscount;
>         }
> --
> 2.17.0
>

The commit subject should "unneeded", not "unneded".  Otherwise, LGTM.

Thanks.
diff mbox series

Patch

diff --git a/resolv/res_send.c b/resolv/res_send.c
index 9e9541789b..947ebf5212 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -472,10 +472,7 @@  __res_context_send (struct resolv_context *ctx,
 					sizeof (struct sockaddr_in6)
 					- sizeof (struct sockaddr_in));
 			else
-			  {
-			    __set_errno (ENOMEM);
-			    return -1;
-			  }
+				return -1;
 		}
 		EXT(statp).nscount = statp->nscount;
 	}