mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Fixing #13783 (garbage-pointer dereference)
This commit is contained in:
parent
1a8cdcbdc8
commit
70e29c914b
@ -109,6 +109,9 @@ nsPluginTag::nsPluginTag()
|
||||
|
||||
inline char* new_str(char* str)
|
||||
{
|
||||
if(str == nsnull)
|
||||
return nsnull;
|
||||
|
||||
char* result = new char[strlen(str) + 1];
|
||||
if (result != nsnull)
|
||||
return strcpy(result, str);
|
||||
|
@ -92,7 +92,7 @@ static char** MakeStringArray(PRUint32 variants, char* data)
|
||||
if((variants == 0) || (data == NULL))
|
||||
return NULL;
|
||||
|
||||
buffer = (char **)PR_Malloc(variants * sizeof(char *));
|
||||
buffer = (char **)PR_Calloc(variants, sizeof(char *));
|
||||
if(!buffer)
|
||||
return NULL;
|
||||
buffer[count] = index;
|
||||
|
@ -109,6 +109,9 @@ nsPluginTag::nsPluginTag()
|
||||
|
||||
inline char* new_str(char* str)
|
||||
{
|
||||
if(str == nsnull)
|
||||
return nsnull;
|
||||
|
||||
char* result = new char[strlen(str) + 1];
|
||||
if (result != nsnull)
|
||||
return strcpy(result, str);
|
||||
|
@ -92,7 +92,7 @@ static char** MakeStringArray(PRUint32 variants, char* data)
|
||||
if((variants == 0) || (data == NULL))
|
||||
return NULL;
|
||||
|
||||
buffer = (char **)PR_Malloc(variants * sizeof(char *));
|
||||
buffer = (char **)PR_Calloc(variants, sizeof(char *));
|
||||
if(!buffer)
|
||||
return NULL;
|
||||
buffer[count] = index;
|
||||
|
Loading…
Reference in New Issue
Block a user