- Plug memory leak (#430879)

This commit is contained in:
Jarod Wilson 2008-02-05 03:52:46 +00:00
parent f515181bc6
commit d95ce41657
2 changed files with 161 additions and 0 deletions

View File

@ -0,0 +1,156 @@
Index: program/src/rrd_update.c
===================================================================
--- program/src/rrd_update.c (revision 1228)
+++ program/src/rrd_update.c (revision 1277)
@@ -1964,5 +1964,5 @@
rrd_file->pos, rrd->rra_def[rra_idx].cf_nam);
#endif
- if (pcdp_summary != NULL) {
+ if (*pcdp_summary != NULL) {
iv.u_val = rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val;
/* append info to the return hash */
Index: program/src/rrd_create.c
===================================================================
--- program/src/rrd_create.c (revision 1271)
+++ program/src/rrd_create.c (revision 1278)
@@ -122,5 +122,5 @@
if ((rrd.stat_head = calloc(1, sizeof(stat_head_t))) == NULL) {
rrd_set_error("allocating rrd.stat_head");
- rrd_free(&rrd);
+ free(rrd.stat_head);
return (-1);
}
@@ -129,5 +129,6 @@
if ((rrd.live_head = calloc(1, sizeof(live_head_t))) == NULL) {
rrd_set_error("allocating rrd.live_head");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
@@ -162,5 +163,6 @@
NULL) {
rrd_set_error("allocating rrd.ds_def");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
@@ -194,5 +196,6 @@
}
if (rrd_test_error()) {
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return -1;
}
@@ -217,5 +220,6 @@
if (rrd_test_error()) {
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return -1;
}
@@ -230,5 +234,6 @@
NULL) {
rrd_set_error("allocating rrd.rra_def");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
@@ -481,5 +486,6 @@
/* all errors are unrecoverable */
free(argvcopy);
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
@@ -508,5 +514,6 @@
-1) {
rrd_set_error("creating contingent RRA");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return -1;
}
@@ -515,5 +522,6 @@
} else {
rrd_set_error("can't parse argument '%s'", argv[i]);
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return -1;
}
@@ -523,5 +531,6 @@
if (rrd.stat_head->rra_cnt < 1) {
rrd_set_error("you must define at least one Round Robin Archive");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
@@ -529,5 +538,6 @@
if (rrd.stat_head->ds_cnt < 1) {
rrd_set_error("you must define at least one Data Source");
- rrd_free(&rrd);
+ free(rrd.stat_head);
+ free(rrd.live_head);
return (-1);
}
@@ -665,5 +675,6 @@
if ((rrd_file = open(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) {
rrd_set_error("creating '%s': %s", file_name, rrd_strerror(errno));
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
return (-1);
}
@@ -680,5 +691,6 @@
if ((rrd->pdp_prep = calloc(1, sizeof(pdp_prep_t))) == NULL) {
rrd_set_error("allocating pdp_prep");
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
close(rrd_file);
return (-1);
@@ -696,5 +708,6 @@
if ((rrd->cdp_prep = calloc(1, sizeof(cdp_prep_t))) == NULL) {
rrd_set_error("allocating cdp_prep");
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
close(rrd_file);
return (-1);
@@ -743,5 +756,6 @@
if ((rrd->rra_ptr = calloc(1, sizeof(rra_ptr_t))) == NULL) {
rrd_set_error("allocating rra_ptr");
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
close(rrd_file);
return (-1);
@@ -760,5 +774,6 @@
if ((unknown = (rrd_value_t *) malloc(512 * sizeof(rrd_value_t))) == NULL) {
rrd_set_error("allocating unknown");
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
close(rrd_file);
return (-1);
@@ -778,5 +793,6 @@
free(unknown);
fdatasync(rrd_file);
- rrd_free(rrd);
+ free(rrd->stat_head);
+ free(rrd->live_head);
if (close(rrd_file) == -1) {
rrd_set_error("creating rrd: %s", rrd_strerror(errno));
@@ -786,4 +802,5 @@
rrd_file_dn = rrd_open(file_name, &rrd_dn, RRD_READONLY);
rrd_dontneed(rrd_file_dn, &rrd_dn);
+ rrd_free(&rrd_dn);
rrd_close(rrd_file_dn);
return (0);

View File

@ -18,6 +18,7 @@ URL: http://oss.oetiker.ch/rrdtool/
Source0: http://oss.oetiker.ch/rrdtool/pub/beta/%{name}-%{version}%{betaver}.tar.gz
Source1: php4-%{svnrev}.tar.gz
Patch0: rrdtool-1.3-beta3-text-align.patch
Patch1: rrdtool-1.3-beta3-plug-mem-leak.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: dejavu-lgc-fonts
BuildRequires: gcc-c++, openssl-devel, freetype-devel
@ -142,6 +143,7 @@ The %{name}-ruby package includes RRDtool bindings for Ruby.
%prep
%setup -q -n %{name}-%{pretag} %{?with_php: -a 1}
%patch0 -p1 -b .align
%patch1 -p1 -b .leak
# Fix to find correct python dir on lib64
%{__perl} -pi -e 's|get_python_lib\(0,0,prefix|get_python_lib\(1,0,prefix|g' \
@ -318,6 +320,9 @@ find examples/ -type f -exec chmod 0644 {} \;
%endif
%changelog
* Mon Feb 04 2008 Jarod Wilson <jwilson@redhat.com> 1.3.0-0.6.beta3
- Plug memory leak (#430879)
* Mon Jan 07 2008 Jarod Wilson <jwilson@redhat.com> 1.3.0-0.5.beta3
- Fix right-aligned text alignment and scaling (Resolves: #427609)