Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 84849 Details for
Bug 109785
net-snmp memory leak with lm_sensors patch
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
fix memory leaks in hr_sensor.c
net-snmp-lm_sensors-memleak.patch (text/plain), 1.45 KB, created by
Alex
on 2006-04-17 11:25:46 UTC
(
hide
)
Description:
fix memory leaks in hr_sensor.c
Filename:
MIME Type:
Creator:
Alex
Created:
2006-04-17 11:25:46 UTC
Size:
1.45 KB
patch
obsolete
>--- net-snmp-5.1.1.old/agent/mibgroup/host/hr_sensor.c 2006-04-16 09:01:24.000000000 +0300 >+++ net-snmp-5.1.1/agent/mibgroup/host/hr_sensor.c 2006-04-16 09:00:07.000000000 +0300 >@@ -240,7 +240,8 @@ > { > /* variables we may use later */ > static long long_ret; >- static char *string = 0; >+ static char string[1024]; >+ static char *pstring = 0; > static oid objid[MAX_OID_LEN]; > static struct counter64 c64; > >@@ -281,19 +282,20 @@ > > case HRSENSORNAME: > >- string = malloc(SPRINT_MAX_LEN); >- strncpy(string, sensor->name, SPRINT_MAX_LEN); >+ memset(string,0,sizeof(string)); >+ strncpy(string, sensor->name, strlen(sensor->name)); > *var_len = strlen(string); > return (unsigned char *) string; > > case HRSENSORLABEL: > >- string = malloc(SPRINT_MAX_LEN); >- >- if (sensors_get_label_dl (chip_name, sensor->number, &string)) { >+ memset(string,0,sizeof(string)); >+ >+ if (sensors_get_label_dl (chip_name, sensor->number, &pstring)) { > return 0; > } >- >+ strncpy(string,pstring,sizeof(string)); >+ free(pstring); > *var_len = strlen(string); > return (unsigned char *) string; > >@@ -306,8 +308,8 @@ > } else if (sensors_get_feature_dl (chip_name, sensor->number, &value)){ > return 0; > } >- string = malloc(SPRINT_MAX_LEN); >- snprintf(string, SPRINT_MAX_LEN, "%f", value); >+ memset(string,0,sizeof(string)); >+ sprintf(string, "%f", value); > *var_len = strlen(string); > return (unsigned char *) string; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 109785
:
76955
| 84849