Always release the object dictionary returned by xbps_find_pkg_dict_installed().
Document this in the public API header and update all code accordingly.
This commit is contained in:
parent
ab10cc3b15
commit
679833156a
@ -105,6 +105,7 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
printf("Package %s is not installed.\n", pkgname);
|
printf("Package %s is not installed.\n", pkgname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
prop_object_release(pkgd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for props.plist metadata file.
|
* Check for props.plist metadata file.
|
||||||
@ -296,8 +297,6 @@ out:
|
|||||||
prop_object_release(filesd);
|
prop_object_release(filesd);
|
||||||
if (propsd)
|
if (propsd)
|
||||||
prop_object_release(propsd);
|
prop_object_release(propsd);
|
||||||
if (pkgd)
|
|
||||||
prop_object_release(pkgd);
|
|
||||||
if (broken)
|
if (broken)
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
|
|
||||||
|
@ -161,6 +161,7 @@ xbps_remove_installed_pkgs(int argc, char **argv, bool force, bool purge)
|
|||||||
"PACKAGES!\n", argv[i], version);
|
"PACKAGES!\n", argv[i], version);
|
||||||
reqby_force = true;
|
reqby_force = true;
|
||||||
}
|
}
|
||||||
|
prop_object_release(dict);
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
return 0;
|
return 0;
|
||||||
@ -185,6 +186,7 @@ xbps_remove_installed_pkgs(int argc, char **argv, bool force, bool purge)
|
|||||||
cols = strlen(argv[i]) + strlen(version) + 4;
|
cols = strlen(argv[i]) + strlen(version) + 4;
|
||||||
}
|
}
|
||||||
printf("%s-%s ", argv[i], version);
|
printf("%s-%s ", argv[i], version);
|
||||||
|
prop_object_release(dict);
|
||||||
}
|
}
|
||||||
printf("\n\n");
|
printf("\n\n");
|
||||||
if (!force && !xbps_noyes("Do you want to continue?")) {
|
if (!force && !xbps_noyes("Do you want to continue?")) {
|
||||||
@ -199,6 +201,7 @@ xbps_remove_installed_pkgs(int argc, char **argv, bool force, bool purge)
|
|||||||
if (dict == NULL)
|
if (dict == NULL)
|
||||||
continue;
|
continue;
|
||||||
prop_dictionary_get_cstring_nocopy(dict, "version", &version);
|
prop_dictionary_get_cstring_nocopy(dict, "version", &version);
|
||||||
|
prop_object_release(dict);
|
||||||
if ((rv = pkg_remove_and_purge(argv[i], version, purge)) != 0)
|
if ((rv = pkg_remove_and_purge(argv[i], version, purge)) != 0)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,7 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define XBPS_FLAG_FORCE 0x00000002
|
#define XBPS_FLAG_FORCE 0x00000002
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @cond
|
* @cond
|
||||||
*/
|
*/
|
||||||
@ -478,7 +479,9 @@ prop_dictionary_t xbps_find_pkg_from_plist(const char *plist,
|
|||||||
* by using a package pattern. If false, \a str is assumed to be a package name.
|
* by using a package pattern. If false, \a str is assumed to be a package name.
|
||||||
*
|
*
|
||||||
* @return The package's dictionary on success, NULL otherwise and
|
* @return The package's dictionary on success, NULL otherwise and
|
||||||
* errno is set appropiately.
|
* errno is set appropiately. Returned dictionary is copied via
|
||||||
|
* prop_dictionary_copy(), which means that caller is responsible to
|
||||||
|
* release the object with prop_object_release() when done.
|
||||||
*/
|
*/
|
||||||
prop_dictionary_t xbps_find_pkg_dict_installed(const char *str,
|
prop_dictionary_t xbps_find_pkg_dict_installed(const char *str,
|
||||||
bool bypattern);
|
bool bypattern);
|
||||||
|
@ -114,6 +114,7 @@ xbps_get_pkg_state_installed(const char *pkgname, pkg_state_t *state)
|
|||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
*state = get_state(pkgd);
|
*state = get_state(pkgd);
|
||||||
|
prop_object_release(pkgd);
|
||||||
if (*state == 0)
|
if (*state == 0)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user