aboutsummaryrefslogtreecommitdiff
path: root/libX11/src
diff options
context:
space:
mode:
Diffstat (limited to 'libX11/src')
-rw-r--r--libX11/src/FSWrap.c2
-rw-r--r--libX11/src/RdBitF.c5
-rw-r--r--libX11/src/xcms/LRGB.c8
3 files changed, 10 insertions, 5 deletions
diff --git a/libX11/src/FSWrap.c b/libX11/src/FSWrap.c
index a94709365..94d94fbe9 100644
--- a/libX11/src/FSWrap.c
+++ b/libX11/src/FSWrap.c
@@ -131,7 +131,7 @@ copy_string_list(
char **string_list_ret, **list_src, **list_dst, *dst;
int length, count;
- if (string_list == NULL)
+ if (string_list == NULL || list_count == 0)
return (char **) NULL;
string_list_ret = (char **) Xmalloc(sizeof(char *) * list_count);
diff --git a/libX11/src/RdBitF.c b/libX11/src/RdBitF.c
index 07967aebe..ab7d800d3 100644
--- a/libX11/src/RdBitF.c
+++ b/libX11/src/RdBitF.c
@@ -216,6 +216,11 @@ XReadBitmapFileData (
*ptr=value;
}
}
+
+ /* If we got to this point, we read a full bitmap file. Break so we don't
+ * start reading another one from the same file and leak the memory
+ * allocated for the previous one. */
+ break;
} /* end while */
fclose(fstream);
diff --git a/libX11/src/xcms/LRGB.c b/libX11/src/xcms/LRGB.c
index 2dca82ee8..5ecb7d120 100644
--- a/libX11/src/xcms/LRGB.c
+++ b/libX11/src/xcms/LRGB.c
@@ -653,7 +653,7 @@ LINEAR_RGB_InitSCCData(
*/
if (!(pScreenData = (LINEAR_RGB_SCCData *)
Xcalloc (1, sizeof(LINEAR_RGB_SCCData)))) {
- return(XcmsFailure);
+ goto Free_property_return;
}
/* copy matrices */
memcpy((char *)pScreenData, (char *)pScreenDefaultData,
@@ -663,7 +663,7 @@ LINEAR_RGB_InitSCCData(
if (!(pNewMap = (XcmsIntensityMap *)
Xcalloc (1, sizeof(XcmsIntensityMap)))) {
Xfree((char *)pScreenData);
- return(XcmsFailure);
+ goto Free_property_return;
}
pNewMap->visualID = visualID;
pNewMap->screenData = (XPointer)pScreenData;
@@ -802,7 +802,7 @@ FreeBlueTbl:
Xfree((char *)pScreenData->pBlueTbl);
FreeGreenTblElements:
- Xfree((char *)pScreenData->pBlueTbl->pBase);
+ Xfree((char *)pScreenData->pGreenTbl->pBase);
FreeGreenTbl:
Xfree((char *)pScreenData->pGreenTbl);
@@ -817,7 +817,7 @@ Free_property_return:
Xfree ((char *)property_return);
FreeSCCData:
- Xfree((char *)pScreenData);
+ Xfree((char *)pScreenDefaultData);
pPerScrnInfo->state = XcmsInitNone;
return(XcmsFailure);
}