projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kill a few warnings and properly release memory -- martin sperl
[rrdtool.git]
/
src
/
rrd_xport.c
diff --git
a/src/rrd_xport.c
b/src/rrd_xport.c
index
4a7b688
..
a0dd9e7
100644
(file)
--- a/
src/rrd_xport.c
+++ b/
src/rrd_xport.c
@@
-5,6
+5,7
@@
****************************************************************************/
#include <sys/stat.h>
****************************************************************************/
#include <sys/stat.h>
+#include <locale.h>
#include "rrd_tool.h"
#include "rrd_graph.h"
#include "rrd_tool.h"
#include "rrd_graph.h"
@@
-381,6
+382,9
@@
int rrd_graph_xport(image_desc_t *im) {
info.u_cnt = im->step;
grinfo_push(im, sprintf_alloc("graph_step"), RD_I_CNT, info);
info.u_cnt = im->step;
grinfo_push(im, sprintf_alloc("graph_step"), RD_I_CNT, info);
+ /* set locale */
+ char *old_locale = setlocale(LC_NUMERIC,NULL);
+ setlocale(LC_NUMERIC, "C");
/* format it for output */
int r=0;
/* format it for output */
int r=0;
@@
-403,9
+407,20
@@
int rrd_graph_xport(image_desc_t *im) {
default:
break;
}
default:
break;
}
+ /* restore locale */
+ setlocale(LC_NUMERIC, old_locale);
/* handle errors */
if (r) {
/* handle errors */
if (r) {
+ /* free legend */
+ for (unsigned long j = 0; j < col_cnt; j++) {
+ free(legend_v[j]);
+ }
+ free(legend_v);
+ /* free data */
+ free(data);
+ /* free the bufer */
if (buffer.data) {free(buffer.data);}
if (buffer.data) {free(buffer.data);}
+ /* and return with error */
return r;
}
return r;
}
@@
-512,7
+527,7
@@
int rrd_xport_format_sv(char sep, stringbuffer_t *buffer,image_desc_t *im,time_t
localtime_r(&ti,&loc);
strftime(buf,254,timefmt,&loc);
} else {
localtime_r(&ti,&loc);
strftime(buf,254,timefmt,&loc);
} else {
- snprintf(buf,254,"%
ul",
ti);
+ snprintf(buf,254,"%
lld",(long long int)
ti);
}
if (addToBuffer(buffer,buf,0)) { return 1; }
/* write the columns */
}
if (addToBuffer(buffer,buf,0)) { return 1; }
/* write the columns */