antirez / sds

Simple Dynamic Strings library for C
BSD 2-Clause "Simplified" License
4.89k stars 473 forks source link

Dead Store v.2.0.0 #100

Open PatriciaSVMonteiro opened 6 years ago

PatriciaSVMonteiro commented 6 years ago

The value written to &oldfree (sds.c, line 1240) is never used.

if (type != SDS_TYPE_5) {
         test_cond("sdsMakeRoomFor() free", sdsavail(x) >= step);
         oldfree = sdsavail(x);
}

One way to correct this error is to reverse the order of lines 1239 and 1240 and replace sdsavail (x)> = step with oldfree> = step.