From 599cc7afea4c418ff9eff1bd3b4b3d4f157162e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sat, 22 Dec 2018 03:00:04 +0100 Subject: [PATCH] Avoid leaking string copy --- luatexdir/lua/lepdflib.cc | 4 ++-- pdftexdir/pdftoepdf.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/luatexdir/lua/lepdflib.cc b/luatexdir/lua/lepdflib.cc index 6ac6f7a..8239518 100644 --- a/texk/web2c/luatexdir/lua/lepdflib.cc +++ b/texk/web2c/luatexdir/lua/lepdflib.cc @@ -1125,12 +1125,12 @@ m_poppler_get_INT(Dict, getLength); static int m_Dict_add(lua_State * L) { - char *s; + const char *s; udstruct *uin, *uobj; uin = (udstruct *) luaL_checkudata(L, 1, M_Dict); if (uin->pd != NULL && uin->pd->pc != uin->pc) pdfdoc_changed_error(L); - s = copyString(luaL_checkstring(L, 2)); + s = luaL_checkstring(L, 2); uobj = (udstruct *) luaL_checkudata(L, 3, M_Object); ((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d))); return 0; @@ -2051,7 +2051,7 @@ static int m_Object_dictAdd(lua_State * L) pdfdoc_changed_error(L); if (!((Object *) uin->d)->isDict()) luaL_error(L, "Object is not a Dict"); - ((Object *) uin->d)->dictAdd(copyString(s), std::move(*((Object *) uobj->d))); + ((Object *) uin->d)->dictAdd(s, std::move(*((Object *) uobj->d))); return 0; } diff --git a/pdftexdir/pdftoepdf.cc b/pdftexdir/pdftoepdf.cc index 98156ca..2ea5555 100644 --- a/texk/web2c/pdftexdir/pdftoepdf.cc +++ b/texk/web2c/pdftexdir/pdftoepdf.cc @@ -977,7 +977,7 @@ The changes below seem to work fine. } l = dic1.getLength(); for (i = 0; i < l; i++) { - groupDict.dictAdd(copyString(dic1.getKey(i)), + groupDict.dictAdd(dic1.getKey(i), dic1.getValNF(i)); } // end modification -- 2.19.2