2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-29 05:17:57 +00:00

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]
This commit is contained in:
Shawn Routhier 2012-04-11 15:43:34 +00:00
parent 30e7ccb0df
commit bb9189c30a
4 changed files with 15 additions and 10 deletions

View File

@ -140,6 +140,11 @@ work on other platforms. Please report any problems and suggested fixes to
Thanks to Jiri Popelka at Red Hat for the patch. Thanks to Jiri Popelka at Red Hat for the patch.
[ISC-Bugs #22676] [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.2.2 Changes since 4.2.2
- Fix the code that checks for an existing DDNS transaction to cancel - Fix the code that checks for an existing DDNS transaction to cancel

View File

@ -1,10 +1,11 @@
#ifndef LINT #ifndef LINT
static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.9 2009/10/29 00:46:48 sar Exp $"; static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.10 2012/04/11 15:43:34 sar Exp $";
#endif #endif
/* /*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
* Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC") * 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 * Permission to use, copy modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -342,7 +343,7 @@ dst_read_key(const char *in_keyname, const unsigned in_id,
in_alg)); in_alg));
return (NULL); return (NULL);
} }
if ((type && (DST_PUBLIC | DST_PRIVATE)) == 0) if ((type & (DST_PUBLIC | DST_PRIVATE)) == 0)
return (NULL); return (NULL);
if (in_keyname == NULL) { if (in_keyname == NULL) {
EREPORT(("dst_read_private_key(): Null key name passed in\n")); EREPORT(("dst_read_private_key(): Null key name passed in\n"));

View File

@ -3,7 +3,8 @@
Functions supporting the object management protocol... */ 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 * Copyright (c) 1999-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -926,13 +927,11 @@ isc_result_t omapi_protocol_destroy (omapi_object_t *h,
dfree (p -> default_auth, file, line); dfree (p -> default_auth, file, line);
while (p -> remote_auth_list) { while (p -> remote_auth_list) {
omapi_remote_auth_t *r = p -> remote_auth_list -> next; omapi_remote_auth_t *r = p -> remote_auth_list;
p -> remote_auth_list = r; p -> remote_auth_list = p -> remote_auth_list -> next;
if (r) {
omapi_object_dereference (&r -> a, file, line); omapi_object_dereference (&r -> a, file, line);
dfree (r, file, line); dfree (r, file, line);
} }
}
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
} }

View File

@ -2724,7 +2724,7 @@ void parse_group_declaration (cfile, group)
enum dhcp_token token; enum dhcp_token token;
struct group *g; struct group *g;
int declaration = 0; int declaration = 0;
struct group_object *t; struct group_object *t = NULL;
isc_result_t status; isc_result_t status;
char *name = NULL; char *name = NULL;
int deletedp = 0; int deletedp = 0;