Hi,

1) cosmetic typo in error message
  faild should read failed
2) null ptr checks for the arg of free() are superfluous. See
  http://www.opengroup.org/onlinepubs/009695399/functions/free.html
  which mandates that it's perfectly valid to free(NULL);

Please apply.

TIA and cheers,
Bernhard
Index: rrd_thread_safe.c
===================================================================
--- rrd_thread_safe.c	(revision 1064)
+++ rrd_thread_safe.c	(working copy)
@@ -52,7 +52,7 @@ struct rrd_context *rrd_get_context(void
 const char *rrd_strerror(int err) {
     struct rrd_context *ctx = rrd_get_context();
     if (strerror_r(err, ctx->lib_errstr, ctx->errlen)) 
-         return "strerror_r faild. sorry!"; 
+         return "strerror_r failed. sorry!"; 
     else 
          return ctx->lib_errstr; 
 }
Index: rrd_open.c
===================================================================
--- rrd_open.c	(revision 1064)
+++ rrd_open.c	(working copy)
@@ -121,7 +123,7 @@ rrd_open(const char *file_name, FILE **i
     MYFREAD(rrd->stat_head, stat_head_t,  1)
     /* lets see if the first read worked */
     if (ferror( *in_file ) || feof(*in_file)) {
-        rrd_set_error("reading the cookie off %s faild",file_name);
+        rrd_set_error("reading the cookie off %s failed",file_name);
         fclose(*in_file);
         return(-1);
     }        
@@ -191,14 +193,14 @@ void rrd_init(rrd_t *rrd)
 
 void rrd_free(rrd_t *rrd)
 {
-    if (rrd->stat_head) free(rrd->stat_head);
-    if (rrd->ds_def) free(rrd->ds_def);
-    if (rrd->rra_def) free(rrd->rra_def);
-    if (rrd->live_head) free(rrd->live_head);
-    if (rrd->rra_ptr) free(rrd->rra_ptr);
-    if (rrd->pdp_prep) free(rrd->pdp_prep);
-    if (rrd->cdp_prep) free(rrd->cdp_prep);
-    if (rrd->rrd_value) free(rrd->rrd_value);
+    free(rrd->stat_head);
+    free(rrd->ds_def);
+    free(rrd->rra_def);
+    free(rrd->live_head);
+    free(rrd->rra_ptr);
+    free(rrd->pdp_prep);
+    free(rrd->cdp_prep);
+    free(rrd->rrd_value);
 }
 
 /* routine used by external libraries to free memory allocated by
_______________________________________________
rrd-developers mailing list
rrd-developers@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Reply via email to