copy_vector: plug memory leak in error path
Only the array was being freed, not the contents. GitHub issue #202.
This commit is contained in:
@@ -96,7 +96,7 @@ copy_vector(char * const *src)
|
|||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
copy[i] = sudo_mmap_strdup(src[i]);
|
copy[i] = sudo_mmap_strdup(src[i]);
|
||||||
if (copy[i] == NULL) {
|
if (copy[i] == NULL) {
|
||||||
sudo_mmap_free(copy);
|
free_vector(copy);
|
||||||
debug_return_ptr(NULL);
|
debug_return_ptr(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user