mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: avoid dereferencing NULL pointer
Coverity CID 208323 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
260ff50b0a
commit
637210564a
1 changed files with 12 additions and 10 deletions
|
@ -1578,7 +1578,8 @@ static int parse_picture_file(git_repository *repo, const git_tree_entry *entry,
|
||||||
/* remember the picture data so we can handle it when all dive data has been loaded
|
/* remember the picture data so we can handle it when all dive data has been loaded
|
||||||
* the name of the git file is PIC-<hash> */
|
* the name of the git file is PIC-<hash> */
|
||||||
git_blob *blob = git_tree_entry_blob(repo, entry);
|
git_blob *blob = git_tree_entry_blob(repo, entry);
|
||||||
const void *rawdata = git_blob_rawcontent(blob);
|
if (blob) {
|
||||||
|
const void*rawdata = git_blob_rawcontent(blob);
|
||||||
int len = git_blob_rawsize(blob);
|
int len = git_blob_rawsize(blob);
|
||||||
struct picture_entry_list *new_pel = malloc(sizeof(struct picture_entry_list));
|
struct picture_entry_list *new_pel = malloc(sizeof(struct picture_entry_list));
|
||||||
new_pel->next = pel;
|
new_pel->next = pel;
|
||||||
|
@ -1588,6 +1589,7 @@ static int parse_picture_file(git_repository *repo, const git_tree_entry *entry,
|
||||||
pel->len = len;
|
pel->len = len;
|
||||||
pel->hash = strdup(name + 4);
|
pel->hash = strdup(name + 4);
|
||||||
git_blob_free(blob);
|
git_blob_free(blob);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue