Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157139968
D9899.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D9899.diff
View Options
Index: head/sbin/dhclient/parse.c
===================================================================
--- head/sbin/dhclient/parse.c
+++ head/sbin/dhclient/parse.c
@@ -131,8 +131,10 @@
error("no memory for string %s.", val);
memcpy(s, val, valsize);
- if (!parse_semi(cfile))
+ if (!parse_semi(cfile)) {
+ free(s);
return (NULL);
+ }
return (s);
}
@@ -246,9 +248,10 @@
char *val, *t;
size_t valsize;
pair c = NULL;
+ unsigned char *lbufp = NULL;
if (!bufp && *max) {
- bufp = malloc(*max * size / 8);
+ lbufp = bufp = malloc(*max * size / 8);
if (!bufp)
error("can't allocate space for numeric aggregate");
} else
@@ -265,6 +268,7 @@
parse_warn("too few numbers.");
if (token != SEMI)
skip_to_semi(cfile);
+ free(lbufp);
return (NULL);
}
token = next_token(&val, cfile);
@@ -281,6 +285,7 @@
(base != 16 || token != NUMBER_OR_NAME)) {
parse_warn("expecting numeric value.");
skip_to_semi(cfile);
+ free(lbufp);
return (NULL);
}
/*
@@ -302,6 +307,7 @@
/* If we had to cons up a list, convert it now. */
if (c) {
+ free(lbufp);
bufp = malloc(count * size / 8);
if (!bufp)
error("can't allocate space for numeric aggregate.");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 19, 5:28 PM (4 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33322518
Default Alt Text
D9899.diff (1 KB)
Attached To
Mode
D9899: Fix memory leaks in dhclient
Attached
Detach File
Event Timeline
Log In to Comment