summaryrefslogtreecommitdiff
path: root/native/jni/gtk-peer
diff options
context:
space:
mode:
authorAndreas Tobler <a.tobler@schweiz.org>2006-08-14 20:55:09 +0000
committerAndreas Tobler <a.tobler@schweiz.org>2006-08-14 20:55:09 +0000
commita5f1cc979806a91fb53e68495e647e5c95c61d26 (patch)
treea56b36cab5709bcfd7f64f9d0dd2f324183326d1 /native/jni/gtk-peer
parenteecd9b334f2fb26ce3343acc8783e885680fd31d (diff)
downloadclasspath-a5f1cc979806a91fb53e68495e647e5c95c61d26.tar.gz
2006-08-14 Andreas Tobler <a.tobler@schweiz.ch>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c (query_formats): g_free 'name' after usage. g_strfreev 'ch', the gdk_pixbuf_format_get_extensions instance. g_strfreev 'ch', the gdk_pixbuf_format_get_mime_types instance.
Diffstat (limited to 'native/jni/gtk-peer')
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
index c8d9fb551..b92d017a5 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
@@ -210,7 +210,8 @@ query_formats (JNIEnv *env, jclass clazz)
jobject jformat;
GSList *formats, *f;
GdkPixbufFormat *format;
- char **ch, *name;
+ gchar **ch, *name;
+ gint count;
jclass formatClass;
jmethodID addExtensionID;
@@ -240,14 +241,16 @@ query_formats (JNIEnv *env, jclass clazz)
string = (*env)->NewStringUTF(env, name);
g_assert(string != NULL);
- jformat = (*env)->CallStaticObjectMethod
+ jformat = (*env)->CallStaticObjectMethod
(env, clazz, registerFormatID, string,
(jboolean) gdk_pixbuf_format_is_writable(format));
(*env)->DeleteLocalRef(env, string);
+ g_free(name);
g_assert(jformat != NULL);
-
+
ch = gdk_pixbuf_format_get_extensions(format);
+ count = 0;
while (*ch)
{
string = (*env)->NewStringUTF(env, *ch);
@@ -255,9 +258,12 @@ query_formats (JNIEnv *env, jclass clazz)
(*env)->CallVoidMethod (env, jformat, addExtensionID, string);
(*env)->DeleteLocalRef(env, string);
++ch;
+ ++count;
}
-
+ g_strfreev(ch - count);
+
ch = gdk_pixbuf_format_get_mime_types(format);
+ count = 0;
while (*ch)
{
string = (*env)->NewStringUTF(env, *ch);
@@ -265,12 +271,13 @@ query_formats (JNIEnv *env, jclass clazz)
(*env)->CallVoidMethod (env, jformat, addMimeTypeID, string);
(*env)->DeleteLocalRef(env, string);
++ch;
+ ++count;
}
-
+ g_strfreev(ch - count);
(*env)->DeleteLocalRef(env, jformat);
}
-
- g_slist_free(formats);
+
+ g_slist_free(formats);
}