kopia lustrzana https://gitlab.com/sane-project/backends
dll: fix memory leak in load
In the case where we are unable to get a path for loading libs, and instead just use LIBDIR, we set 'src = strdup(LIBDIR)'. However, we never update orig_src to point to src before tokenizing the path with strsep(), so the memory is never freed. Update load to always set orig_src to src so that we don't leak memory.merge-requests/540/head
rodzic
9ac6ee6cd6
commit
de903b84c4
|
@ -477,9 +477,6 @@ load (struct backend *be)
|
|||
DBG (1, "load: malloc failed: %s\n", strerror (errno));
|
||||
return SANE_STATUS_NO_MEM;
|
||||
}
|
||||
if (orig_src)
|
||||
free (orig_src);
|
||||
orig_src = src;
|
||||
snprintf (src, src_len, "%s%s%s", path, DIR_SEP, LIBDIR);
|
||||
}
|
||||
else
|
||||
|
@ -494,6 +491,7 @@ load (struct backend *be)
|
|||
}
|
||||
DBG (3, "load: searching backend `%s' in `%s'\n", be->name, src);
|
||||
|
||||
orig_src = src;
|
||||
dir = strsep (&src, DIR_SEP);
|
||||
|
||||
while (dir)
|
||||
|
|
Ładowanie…
Reference in New Issue