mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 11:58:55 +00:00
fixed memory leak.
This commit is contained in:
parent
3e2ccd6150
commit
d4ba88584d
@ -1215,7 +1215,7 @@ static void convertFileToURL(const nsString &aIn, nsString &aOut)
|
||||
if (PL_strchr(szFile, '\\')) {
|
||||
PRInt32 len = strlen(szFile);
|
||||
PRInt32 sum = len + sizeof(FILE_PROTOCOL);
|
||||
char* lpszFileURL = new char[sum];
|
||||
char* lpszFileURL = (char *)PR_Malloc(sum + 1);
|
||||
|
||||
// Translate '\' to '/'
|
||||
for (PRInt32 i = 0; i < len; i++) {
|
||||
@ -1230,6 +1230,7 @@ static void convertFileToURL(const nsString &aIn, nsString &aOut)
|
||||
// Build the file URL
|
||||
PR_snprintf(lpszFileURL, sum, "%s%s", FILE_PROTOCOL, szFile);
|
||||
aOut = lpszFileURL;
|
||||
PR_Free((void *)lpszFileURL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -1215,7 +1215,7 @@ static void convertFileToURL(const nsString &aIn, nsString &aOut)
|
||||
if (PL_strchr(szFile, '\\')) {
|
||||
PRInt32 len = strlen(szFile);
|
||||
PRInt32 sum = len + sizeof(FILE_PROTOCOL);
|
||||
char* lpszFileURL = new char[sum];
|
||||
char* lpszFileURL = (char *)PR_Malloc(sum + 1);
|
||||
|
||||
// Translate '\' to '/'
|
||||
for (PRInt32 i = 0; i < len; i++) {
|
||||
@ -1230,6 +1230,7 @@ static void convertFileToURL(const nsString &aIn, nsString &aOut)
|
||||
// Build the file URL
|
||||
PR_snprintf(lpszFileURL, sum, "%s%s", FILE_PROTOCOL, szFile);
|
||||
aOut = lpszFileURL;
|
||||
PR_Free((void *)lpszFileURL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user