fixed some small memory leaks
This commit is contained in:
parent
f78f195235
commit
8b48763b5d
1 changed files with 3 additions and 2 deletions
|
@ -90,7 +90,6 @@ void dump_pkg_full(PM_PKG *pkg, int level)
|
||||||
for(i = alpm_list_first(alpm_pkg_getinfo(pkg, PM_PKG_BACKUP)); i; i = alpm_list_next(i)) {
|
for(i = alpm_list_first(alpm_pkg_getinfo(pkg, PM_PKG_BACKUP)); i; i = alpm_list_next(i)) {
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
char *md5sum;
|
|
||||||
char *str = strdup(alpm_list_getdata(i));
|
char *str = strdup(alpm_list_getdata(i));
|
||||||
char *ptr = index(str, '\t');
|
char *ptr = index(str, '\t');
|
||||||
if(ptr == NULL) {
|
if(ptr == NULL) {
|
||||||
|
@ -101,12 +100,14 @@ void dump_pkg_full(PM_PKG *pkg, int level)
|
||||||
ptr++;
|
ptr++;
|
||||||
snprintf(path, PATH_MAX-1, "%s%s", root, str);
|
snprintf(path, PATH_MAX-1, "%s%s", root, str);
|
||||||
if(!stat(path, &buf)) {
|
if(!stat(path, &buf)) {
|
||||||
md5sum = alpm_get_md5sum(path);
|
char *md5sum = alpm_get_md5sum(path);
|
||||||
if(md5sum == NULL) {
|
if(md5sum == NULL) {
|
||||||
ERR(NL, "error calculating md5sum for %s\n", path);
|
ERR(NL, "error calculating md5sum for %s\n", path);
|
||||||
|
FREE(str);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
printf("%sMODIFIED\t%s\n", strcmp(md5sum, ptr) ? "" : "NOT ", path);
|
printf("%sMODIFIED\t%s\n", strcmp(md5sum, ptr) ? "" : "NOT ", path);
|
||||||
|
FREE(md5sum);
|
||||||
} else {
|
} else {
|
||||||
printf("MISSING\t\t%s\n", path);
|
printf("MISSING\t\t%s\n", path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue