Skip to content

Commit

Permalink
hdf-eos: Coverity Scan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Nov 26, 2024
1 parent 1e3a6d5 commit 950cd2a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 4 additions & 1 deletion frmts/hdf4/hdf-eos/EHapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,10 @@ EHmetagroup(int32 sdInterfaceID, const char *structname, const char *structcode,
metaptr = strstr(metaptr, utlstr);

snprintf(utlstr, UTLSTR_MAX_SIZE, "%s%s", "\t\tEND_GROUP=", groupname);
endptr = strstr(metaptr, utlstr);
if (metaptr)
endptr = strstr(metaptr, utlstr);
else
endptr = NULL;
} else
{
/* If groupname == NULL then find end of structure in metadata */
Expand Down
5 changes: 1 addition & 4 deletions frmts/hdf4/hdf-eos/GDapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,6 @@ GDchkgdid(int32 gridID, const char *routname,
/* Compute "reduced" ID */
/* -------------------- */
gID = gridID % idOffset;
if (gID >= NGRID)
{
return -1;
}

/* Check for active grid ID */
/* ------------------------ */
Expand Down Expand Up @@ -3117,6 +3113,7 @@ GDnentries(int32 gridID, int32 entrycode, int32 * strbufsize)
if (!metabuf || metaptrs[0] == NULL)
{
free(metabuf);
free(utlstr);
return -1;
}

Expand Down
5 changes: 1 addition & 4 deletions frmts/hdf4/hdf-eos/SWapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,6 @@ SWchkswid(int32 swathID, const char *routname,
else
{
int sID = swathID % idOffset;
if (sID >= NSWATH)
{
return -1;
}
/* Check for active swath ID */
/* ------------------------- */
if (SWXSwath[sID].active == 0)
Expand Down Expand Up @@ -3023,6 +3019,7 @@ SWSDfldsrch(int32 swathID, int32 sdInterfaceID, const char *fieldname,
sID = swathID % idOffset;
if (sID >= NSWATH)
{
free(utlstr);
return -1;
}

Expand Down

0 comments on commit 950cd2a

Please sign in to comment.