Code

Don't hold on to pointer returned from c_str(). Might help bug 307567
authorjoncruz <joncruz@users.sourceforge.net>
Wed, 21 Jan 2009 13:44:37 +0000 (13:44 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Wed, 21 Jan 2009 13:44:37 +0000 (13:44 +0000)
src/color-profile.cpp

index 42650b1704b15879361b2a0b45e2df37dd0e76ce..d3a7b9a4dbb1d3572bce78b6e068204e2eb1f8ba 100644 (file)
@@ -265,7 +265,7 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value )
                     //# 3.  Resolve the href according the docBase.  This follows
                     //      the w3c specs.  All absolute and relative issues are considered
                     org::w3c::dom::URI cprofUri = docUri.resolve(hrefUri);
-                    gchar* fullname = (gchar *)cprofUri.getNativePath().c_str();
+                    gchar* fullname = g_strdup((gchar *)cprofUri.getNativePath().c_str());
                     cprof->_clearProfile();
                     cprof->profHandle = cmsOpenProfileFromFile( fullname, "r" );
                     if ( cprof->profHandle ) {
@@ -277,6 +277,7 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value )
 #endif // DEBUG_LCMS
 
 #endif // ENABLE_LCMS
+                    g_free(fullname);
                 }
             }
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);