From e943eb2d52abcd6e36f249576b8beb654abe0704 Mon Sep 17 00:00:00 2001 From: oetiker Date: Wed, 22 Feb 2012 10:27:42 +0000 Subject: [PATCH] kill a few warnings and properly release memory -- martin sperl git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2275 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_xport.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/rrd_xport.c b/src/rrd_xport.c index 4a7b688..a0dd9e7 100644 --- a/src/rrd_xport.c +++ b/src/rrd_xport.c @@ -5,6 +5,7 @@ ****************************************************************************/ #include +#include #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); + /* set locale */ + char *old_locale = setlocale(LC_NUMERIC,NULL); + setlocale(LC_NUMERIC, "C"); /* format it for output */ int r=0; @@ -403,9 +407,20 @@ int rrd_graph_xport(image_desc_t *im) { default: break; } + /* restore locale */ + setlocale(LC_NUMERIC, old_locale); /* 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);} + /* and return with error */ 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 { - snprintf(buf,254,"%ul",ti); + snprintf(buf,254,"%lld",(long long int)ti); } if (addToBuffer(buffer,buf,0)) { return 1; } /* write the columns */ -- 2.11.0