diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index 7e697d3..ddb3806 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -616,9 +616,11 @@ pkgconf_pkg_find(pkgconf_client_t *client, const char *name) PKGCONF_TRACE(client, "%s is a file", name); pkg = pkgconf_pkg_new_from_file(client, name, f); - pkgconf_path_add(pkg_get_parent_dir(pkg), &client->dir_list, true); - - return pkg; + if (pkg != NULL) + { + pkgconf_path_add(pkg_get_parent_dir(pkg), &client->dir_list, true); + return pkg; + } } } diff --git a/tests/lib1/malformed-1.pc b/tests/lib1/malformed-1.pc new file mode 100644 index 0000000..4f4a700 --- /dev/null +++ b/tests/lib1/malformed-1.pc @@ -0,0 +1,2 @@ +prefix=/usr\nName: GKrellM\nDescription: Extensible GTK system monitoring application\nVersion: 2.3.7\nRequires: gtk+-2.0 >= 2.4.0\nCflags: -I/usr/include\n +