Add two missing NULL checks of malloc'd values on Android
* src/android.c (sendDndUri, sendDndText): Verify that allocated string memory is non-nil before writing to it.
This commit is contained in:
parent
81ca9c75f1
commit
58e4bfe340
1 changed files with 10 additions and 0 deletions
|
@ -2530,6 +2530,11 @@ NATIVE_NAME (sendDndUri) (JNIEnv *env, jobject object,
|
||||||
|
|
||||||
length = (*env)->GetStringLength (env, string);
|
length = (*env)->GetStringLength (env, string);
|
||||||
buffer = malloc (length * sizeof *buffer);
|
buffer = malloc (length * sizeof *buffer);
|
||||||
|
|
||||||
|
/* Out of memory. */
|
||||||
|
if (!buffer)
|
||||||
|
return 0;
|
||||||
|
|
||||||
characters = (*env)->GetStringChars (env, string, NULL);
|
characters = (*env)->GetStringChars (env, string, NULL);
|
||||||
|
|
||||||
if (!characters)
|
if (!characters)
|
||||||
|
@ -2567,6 +2572,11 @@ NATIVE_NAME (sendDndText) (JNIEnv *env, jobject object,
|
||||||
|
|
||||||
length = (*env)->GetStringLength (env, string);
|
length = (*env)->GetStringLength (env, string);
|
||||||
buffer = malloc (length * sizeof *buffer);
|
buffer = malloc (length * sizeof *buffer);
|
||||||
|
|
||||||
|
/* Out of memory. */
|
||||||
|
if (!buffer)
|
||||||
|
return 0;
|
||||||
|
|
||||||
characters = (*env)->GetStringChars (env, string, NULL);
|
characters = (*env)->GetStringChars (env, string, NULL);
|
||||||
|
|
||||||
if (!characters)
|
if (!characters)
|
||||||
|
|
Loading…
Add table
Reference in a new issue