forked from Imagelibrary/rtems
2003-02-20 Till Straumann <strauman@slac.stanford.edu>
PR 351/networking * nfs/bootp_subr.c: Fix ridiculous leak in bootp and use strdup_bootp_realloc() everywhere for sake of consistency.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2003-02-20 Till Straumann <strauman@slac.stanford.edu>
|
||||||
|
|
||||||
|
PR 351/networking
|
||||||
|
* nfs/bootp_subr.c: Fix ridiculous leak in bootp and use
|
||||||
|
strdup_bootp_realloc() everywhere for sake of consistency.
|
||||||
|
|
||||||
2003-02-11 Mike Siers <mikes@poliac.com>
|
2003-02-11 Mike Siers <mikes@poliac.com>
|
||||||
|
|
||||||
* rtems/rtems_glue.c: A small patch to the network daemon task
|
* rtems/rtems_glue.c: A small patch to the network daemon task
|
||||||
|
|||||||
@@ -274,11 +274,13 @@ void *bootp_strdup_realloc(char *dst,const char *src)
|
|||||||
|
|
||||||
if (dst == NULL) {
|
if (dst == NULL) {
|
||||||
/* first allocation, simply use strdup */
|
/* first allocation, simply use strdup */
|
||||||
dst = strdup(src);
|
if (src)
|
||||||
|
dst = strdup(src);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* already allocated, so use realloc/strcpy */
|
/* already allocated, so use realloc/strcpy */
|
||||||
len = strlen(src) + 1;
|
len = src ? strlen(src) + 1 : 0;
|
||||||
|
/* src == NULL tells us to effectively free dst */
|
||||||
dst = realloc(dst,len);
|
dst = realloc(dst,len);
|
||||||
if (dst != NULL) {
|
if (dst != NULL) {
|
||||||
strcpy(dst,src);
|
strcpy(dst,src);
|
||||||
@@ -945,7 +947,10 @@ bootpc_init(int update_files)
|
|||||||
update_files = 0;
|
update_files = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dhcp_hostname = NULL;
|
if (dhcp_hostname != NULL) {
|
||||||
|
/* free it */
|
||||||
|
dhcp_hostname=bootp_strdup_realloc(dhcp_hostname,0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find a network interface.
|
* Find a network interface.
|
||||||
|
|||||||
Reference in New Issue
Block a user