Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libloc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
libloc
Commits
c820094d
Commit
c820094d
authored
Sep 26, 2019
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perl: Release location context when opening the database fails
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
74ad091d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
src/perl/Location/Location.xs
src/perl/Location/Location.xs
+9
-2
No files found.
src/perl/Location/Location.xs
View file @
c820094d
...
@@ -16,7 +16,7 @@ MODULE = Location PACKAGE = Location
...
@@ -16,7 +16,7 @@ MODULE = Location PACKAGE = Location
struct loc_database *
struct loc_database *
init(file)
init(file)
char
* file
;
char
* file = NULL
;
CODE:
CODE:
struct loc_ctx* ctx = NULL;
struct loc_ctx* ctx = NULL;
...
@@ -29,17 +29,24 @@ init(file)
...
@@ -29,17 +29,24 @@ init(file)
// Open the database file for reading
// Open the database file for reading
FILE* f = fopen(file, "r");
FILE* f = fopen(file, "r");
if (!f) {
if (!f) {
loc_unref(ctx);
croak("Could not open file for reading: %s: %s\n",
croak("Could not open file for reading: %s: %s\n",
file, strerror(errno));
file, strerror(errno));
}
}
// Parse the database
// Parse the database
struct loc_database
*
db = NULL;
struct loc_database
*
db = NULL;
err = loc_database_new(ctx, &db, f);
err = loc_database_new(ctx, &db, f);
if (err) {
if (err) {
loc_unref(ctx);
croak("Could not read database: %s\n", file);
croak("Could not read database: %s\n", file);
}
}
// Cleanup
loc_unref(ctx);
RETVAL = db;
RETVAL = db;
OUTPUT:
OUTPUT:
RETVAL
RETVAL
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment