From 6c6b52f5b277075f67db8a831b1ac70699ec47d7 Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Sun, 20 Nov 2016 21:58:11 +1000 Subject: [PATCH] Gmt module: Fix bad assignment to uninitialised pointer in previous commit. --- modules/gmt/modgmt_gsfuncs.cpp | 4 +++- modules/gmt/modgmt_internals.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/gmt/modgmt_gsfuncs.cpp b/modules/gmt/modgmt_gsfuncs.cpp index 32f5614..1544645 100644 --- a/modules/gmt/modgmt_gsfuncs.cpp +++ b/modules/gmt/modgmt_gsfuncs.cpp @@ -82,6 +82,7 @@ static int GhostRun(const std::string& opts, struct gs_runtime* r, std::string* { struct gsworkthreadpars wp; int* pret; + int ret=0; wp.r=r; wp.input_callback=input; @@ -96,7 +97,7 @@ static int GhostRun(const std::string& opts, struct gs_runtime* r, std::string* ssize_t br; char buffer[4096]; - if(0!=pipe(pipefd)) {*pret=-1; goto end;} + if(0!=pipe(pipefd)) {ret=-1; goto end;} wp.fd=pipefd[1]; out->erase(); @@ -113,6 +114,7 @@ static int GhostRun(const std::string& opts, struct gs_runtime* r, std::string* else pret=reinterpret_cast(gsworkthread(&wp)); end: + if(0!=ret) return ret; return *pret; } diff --git a/modules/gmt/modgmt_internals.cpp b/modules/gmt/modgmt_internals.cpp index 7cc1744..fb29441 100644 --- a/modules/gmt/modgmt_internals.cpp +++ b/modules/gmt/modgmt_internals.cpp @@ -44,8 +44,9 @@ int callgmtmodule(void *api, const char *module, struct GMT_OPTION *opts, std::s pthread_t wthr; struct gmtworkthreadpars p; int *pret; + int ret=0; - if(0!=pipe(pipefd)) {*pret=-1; goto end;} + if(0!=pipe(pipefd)) {ret=-1; goto end;} p.api=api; p.module=module; p.opts=opts; @@ -60,6 +61,7 @@ int callgmtmodule(void *api, const char *module, struct GMT_OPTION *opts, std::s pthread_join(wthr,reinterpret_cast(&pret)); end: + if(0!=ret) return ret; return *pret; } // Overloaded variant with opts as std::string