From 65231cf83eec37136cb10be3e7016c4de7741353 Mon Sep 17 00:00:00 2001 From: Shawn Routhier Date: Wed, 11 Apr 2012 15:44:14 +0000 Subject: [PATCH] Fix up some issues found by static analysis A potential memory leak and NULL dereference in omapi. The use of a boolean test instead of a bitwise test in dst. [ISC-Bugs #28941] --- RELNOTES | 5 +++++ dst/dst_api.c | 5 +++-- omapip/protocol.c | 13 ++++++------- server/confpars.c | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/RELNOTES b/RELNOTES index 695875e72..7d159d846 100644 --- a/RELNOTES +++ b/RELNOTES @@ -106,6 +106,11 @@ work on other platforms. Please report any problems and suggested fixes to Thanks to Jiri Popelka at Red Hat for the patch. [ISC-Bugs #22676] +- Fix up some issues found by static analysis + A potential memory leak and NULL dereference in omapi. + The use of a boolean test instead of a bitwise test in dst. + [ISC-Bugs #28941] + Changes since 4.1-ESV-R3 - Add AM_MAINTAINER_MODE to configure.ac to avoid rebuilding diff --git a/dst/dst_api.c b/dst/dst_api.c index 6ec8f022a..b05400855 100644 --- a/dst/dst_api.c +++ b/dst/dst_api.c @@ -1,10 +1,11 @@ #ifndef LINT -static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.6.220.1 2009/01/22 02:07:42 sar Exp $"; +static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.6.220.1.10.1 2012/04/11 15:44:14 sar Exp $"; #endif /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. * Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -341,7 +342,7 @@ dst_read_key(const char *in_keyname, const unsigned in_id, in_alg)); return (NULL); } - if ((type && (DST_PUBLIC | DST_PRIVATE)) == 0) + if ((type & (DST_PUBLIC | DST_PRIVATE)) == 0) return (NULL); if (in_keyname == NULL) { EREPORT(("dst_read_private_key(): Null key name passed in\n")); diff --git a/omapip/protocol.c b/omapip/protocol.c index 5b4063f3f..62a3c9ffc 100644 --- a/omapip/protocol.c +++ b/omapip/protocol.c @@ -3,7 +3,8 @@ Functions supporting the object management protocol... */ /* - * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -926,12 +927,10 @@ isc_result_t omapi_protocol_destroy (omapi_object_t *h, dfree (p -> default_auth, file, line); while (p -> remote_auth_list) { - omapi_remote_auth_t *r = p -> remote_auth_list -> next; - p -> remote_auth_list = r; - if (r) { - omapi_object_dereference (&r -> a, file, line); - dfree (r, file, line); - } + omapi_remote_auth_t *r = p -> remote_auth_list; + p -> remote_auth_list = p -> remote_auth_list -> next; + omapi_object_dereference (&r -> a, file, line); + dfree (r, file, line); } return ISC_R_SUCCESS; } diff --git a/server/confpars.c b/server/confpars.c index 20f5e832a..03778ad6f 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -2741,7 +2741,7 @@ void parse_group_declaration (cfile, group) enum dhcp_token token; struct group *g; int declaration = 0; - struct group_object *t; + struct group_object *t = NULL; isc_result_t status; char *name = NULL; int deletedp = 0; -- 2.47.3