ckolivas / lrzip

Long Range Zip

Home Page:http://lrzip.kolivas.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#216 may have other issues

pete4abw opened this issue · comments

The function rzip_control_free() is only used by the library. I've dumped it. But if you keep this function, there are several other heap issues that may arise. control->outname and control->outdir come to mind... #216 may not be finished yet.

rzip.c

1260 void rzip_control_free(rzip_control *control)
1261 {
1262         if (!control)
1263                 return;
1264 
1265         dealloc(control->tmpdir);
1266         dealloc(control->outname);
1267         dealloc(control->outdir);
1268         if (control->suffix && control->suffix[0])
1269                 dealloc(control->suffix);
1270 
1271         dealloc(control);

main.c

458                 case 'o': 
459                         if (control->outdir)
460                                 failure("Cannot have -o and -O together\n");
461                         if (unlikely(STDOUT))
462                                 failure("Cannot specify an output filename when outputting to stdout\n");
463                         control->outname = optarg;
464                         dealloc(control->suffix);
465                         control->suffix = strdup("");
466                         break;

You're right. I should just deprecate the unused library.