lib/package_alternatives.c: fix CID 284970 (Resource leak).
Also fix calloc args order.
This commit is contained in:
parent
c5904cc6ef
commit
7b623783c8
@ -98,7 +98,9 @@ relpath(char *from, char *to)
|
|||||||
|
|
||||||
for (up = -1, from--; from && *from; from = strchr(from + 1, '/'), up++);
|
for (up = -1, from--; from && *from; from = strchr(from + 1, '/'), up++);
|
||||||
|
|
||||||
rel = calloc(3 * up + strlen(p), sizeof(char));
|
rel = calloc(1, 3 * up + strlen(p));
|
||||||
|
if (!rel)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
while (up--)
|
while (up--)
|
||||||
strcat(rel, "../");
|
strcat(rel, "../");
|
||||||
|
Loading…
Reference in New Issue
Block a user