]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
src/rrd_client.c: fix memeory leak in rrd_client_info 813/head
authorJoaquín Aguirrezabalaga <kinote@kinote.org>
Thu, 20 Jul 2017 06:21:29 +0000 (08:21 +0200)
committerJoaquín Aguirrezabalaga <kinote@kinote.org>
Thu, 20 Jul 2017 06:25:15 +0000 (08:25 +0200)
A string is being duplicated with strdup and the copy was not being
freed.

src/rrd_client.c

index 1bfbef2a9a7f04d6e41e7b3e8a8260b523a93f48..9786f8e0d0bbd9716e20943be1b92a5189f4f621 100644 (file)
@@ -1279,6 +1279,10 @@ rrd_info_t *rrd_client_info(rrd_client_t *client, const char *filename) /* {{{ *
 
     cd = rrd_info_push(cd, sprintf_alloc("%s",k), itype, info);
        if(!data) data = cd;
+    if (itype == RD_I_STR) {
+      free(info.u_str);
+      info.u_str = NULL;
+    }
   }
 
 out_free_res: