Fix bug that would cause a double free if setup files and free is called

This commit is contained in:
Danila Fedorin 2017-05-05 19:48:23 -07:00
parent 1a7ba8e393
commit a04490cbdd

View File

@ -14,6 +14,8 @@ libds_result sprs_setup(sprs* sprs, int size){
if(sprs->sparse == NULL || sprs->dense == NULL){ if(sprs->sparse == NULL || sprs->dense == NULL){
free(sprs->sparse); free(sprs->sparse);
free(sprs->dense); free(sprs->dense);
sprs->sparse = NULL;
sprs->dense = NULL;
result = LIBDS_MALLOC; result = LIBDS_MALLOC;
} else { } else {
sprs->capacity = size; sprs->capacity = size;