w32: Fix memory leak for npth_create.
authorNIIBE Yutaka <gniibe@fsij.org>
Thu, 30 Nov 2017 02:14:23 +0000 (11:14 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Thu, 30 Nov 2017 02:14:23 +0000 (11:14 +0900)
* w32/npth.c (npth_create): Free ATTR when allocated.
(npth_attr_destroy): Clear.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
w32/npth.c

index 1dad63e..6ea6d19 100644 (file)
@@ -384,6 +384,7 @@ int
 npth_attr_destroy (npth_attr_t *attr)
 {
   free (*attr);
 npth_attr_destroy (npth_attr_t *attr)
 {
   free (*attr);
+  *attr = NULL;
   return 0;
 }
 
   return 0;
 }
 
@@ -531,6 +532,9 @@ npth_create (npth_t *newthread, const npth_attr_t *user_attr,
 
   ResumeThread (thread->handle);
 
 
   ResumeThread (thread->handle);
 
+  if (attr_allocated)
+    npth_attr_destroy (&attr);
+
   return 0;
 
  err_out:
   return 0;
 
  err_out: