[pve-devel] [PATCH] add new pve2.3-vm stream

Alexandre DERUMIER aderumier at odiso.com
Wed Jan 16 11:25:53 CET 2013


Oh,sorry, I'm pretty poor with C code. (Don't have use it since school ;)

I'll test it this afternoon


----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre Derumier" <aderumier at odiso.com>, pve-devel at pve.proxmox.com 
Envoyé: Mercredi 16 Janvier 2013 10:05:45 
Objet: RE: [pve-devel] [PATCH] add new pve2.3-vm stream 

Your code introduces a memory leak, and does not share common code. 

I committed a fixed version. Please can you test? 

> Signed-off-by: Alexandre Derumier <aderumier at odiso.com> 
> --- 
> data/src/status.c | 20 ++++++++++++++++++++ 
> 1 file changed, 20 insertions(+) 
> 
> diff --git a/data/src/status.c b/data/src/status.c index 304fcf4..f6e89b3 
> 100644 
> --- a/data/src/status.c 
> +++ b/data/src/status.c 
> @@ -942,6 +942,26 @@ update_rrd_data( 
> create_rrd_file(filename, argcount, rrd_def_node); 
> } 
> 
> + } else if (strncmp(key, "pve2.3-vm/", 10) == 0) { 
> + const char *vmid = key + 10; 
> + 
> + skip = 3; 
> + 
> + if (strchr(vmid, '/') != NULL) 
> + goto keyerror; 
> + 
> + if (strlen(vmid) < 1) 
> + goto keyerror; 
> + 
> + filename = g_strdup_printf(RRDDIR "/%s/%s", "pve2-vm", 
> vmid); 

this is the memory leak, because we lose the pointer to the already allocated filename. 



More information about the pve-devel mailing list