schwer-q / xar

Automatically exported from code.google.com/p/xar
0 stars 0 forks source link

Invalid fspath when add file from buffer #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The xar_file_t fspath is incorrectly initialized in xar_add_frombuffer (at 
least) when parent is not 
null.

the char*tmp var in never initialized and is then affected to 
XAR_FILE(ret)->fspath.
This cause a "Deallocation of a pointer not malloced" in xar_close() -> 
xar_file_free();

<<<<
xar_file_t xar_add_frombuffer(xar_t x, xar_file_t parent, const char *name, 
char *buffer, size_t 
length) {
    xar_file_t ret;
    char *tmp;
    char idstr[32];
<<<<    
    if( !parent ) {
           ...
    } else {
       ...
        XAR_FILE(ret)->fspath = tmp;
    }
<<<<

Original issue reported on code.google.com by jddu...@gmail.com on 20 Feb 2007 at 4:12

GoogleCodeExporter commented 9 years ago
Thanks for the diagnosis, I have initialized the fspath to NULL which is valid 
to
free and the various modules appear fine with.

If this resolves your problem, we can set the status to Verified.

Original comment by bbraun on 20 Feb 2007 at 8:11

GoogleCodeExporter commented 9 years ago
That's ok, It solve my problem. 
(but apparently i cannot change the issus status)

Original comment by jddu...@gmail.com on 21 Feb 2007 at 8:08

GoogleCodeExporter commented 9 years ago
Ok, thanks.  I'm marking the problem as verified.

Original comment by bbraun on 21 Feb 2007 at 2:21