Added missing check

This commit is contained in:
Luca Deri
2021-02-04 18:17:45 +01:00
parent 6c366d73e2
commit c68c8c79c9
+4 -2
View File
@@ -136,8 +136,10 @@ void *ndpi_realloc(void *ptr, size_t old_size, size_t new_size) {
if(!ret) if(!ret)
return(ret); return(ret);
else { else {
memcpy(ret, ptr, old_size); if(ptr != NULL) {
ndpi_free(ptr); memcpy(ret, ptr, old_size);
ndpi_free(ptr);
}
return(ret); return(ret);
} }
} }