From: Erwan Velu Date: Sun, 3 Apr 2011 18:57:51 +0000 (+0200) Subject: hdt: Removing corruption on printf X-Git-Tag: syslinux-4.05-pre1~20^2~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ca3c9cc9eeb578b60c4d27746dc4e7447face0c;p=platform%2Fupstream%2Fsyslinux.git hdt: Removing corruption on printf Prior to this commit some garbage occured. The printing buffer wasn't correctly cleaned after usage. --- diff --git a/com32/hdt/hdt-dump.c b/com32/hdt/hdt-dump.c index 9b0fe7b..c09568c 100644 --- a/com32/hdt/hdt-dump.c +++ b/com32/hdt/hdt-dump.c @@ -70,16 +70,21 @@ int dumpprintf(FILE *p, const char *format, ...) { return rv; } -void flush (char *filename, ZZJSON_CONFIG *config, ZZJSON ** item) { - zzjson_print(config, *item); +void to_cpio(char *filename) { cpio_writefile(upload,filename,p_buf.buf,p_buf.len); - if ((p_buf.buf) && (p_buf.size > 0)){ - memset(p_buf.buf,0,p_buf.size); + if ((p_buf.buf) && (p_buf.len > 0)){ + memset(p_buf.buf,0,p_buf.len); free(p_buf.buf); + p_buf.buf=NULL; p_buf.size=0; p_buf.len=0; } +} + +void flush (ZZJSON_CONFIG *config, ZZJSON ** item) { + zzjson_print(config, *item); zzjson_free(config, *item); + *item=NULL; } /** @@ -97,6 +102,8 @@ void dump(struct s_hardware *hardware) (int(*)(int,void*)) fputc }; + memset(&p_buf,0,sizeof(p_buf)); + /* By now, we only support TFTP reporting */ upload=&upload_tftp; upload->name="tftp";