Skip to content

Commit e63b441

Browse files
author
Ole John Aske
committed
Fix for Bug#18181656 PSET_DESTROY() CALLED WITH INCORRECT ARGUMENT
When compiled for Solaris, pset_destroy() was called with a 'psetid_t*' argument, instead of a 'psetid_t'. This patch also removes some obsolete typecasts to 'void*' and 'char*' when calling free(void*) and NdbMem_Free(void*)
1 parent 5f995eb commit e63b441

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

storage/ndb/src/common/portlib/NdbThread.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -327,7 +327,7 @@ NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
327327

328328
if (result != 0)
329329
{
330-
NdbMem_Free((char *)tmpThread);
330+
NdbMem_Free(tmpThread);
331331
NdbMutex_Unlock(g_ndb_thread_mutex);
332332
DBUG_RETURN(0);
333333
}
@@ -368,7 +368,7 @@ void NdbThread_Destroy(struct NdbThread** p_thread)
368368
#ifdef HAVE_LINUX_SCHEDULING
369369
if ((*p_thread)->orig_cpu_set)
370370
{
371-
free((void*)(*p_thread)->orig_cpu_set);
371+
free((*p_thread)->orig_cpu_set);
372372
(*p_thread)->orig_cpu_set = NULL;
373373
}
374374
#endif
@@ -574,7 +574,7 @@ NdbThread_UnlockCPU(struct NdbThread* pThread)
574574
{
575575
error_no = errno;
576576
}
577-
free((void*)pThread->orig_cpu_set);
577+
free(pThread->orig_cpu_set);
578578
pThread->orig_cpu_set = NULL;
579579
}
580580
#elif defined HAVE_SOLARIS_AFFINITY
@@ -716,9 +716,9 @@ NdbThread_LockCreateCPUSet(const Uint32 *cpu_ids,
716716
return 0;
717717

718718
late_error:
719-
pset_destroy(cpu_set_ptr);
719+
pset_destroy(*cpu_set_ptr);
720720
error:
721-
free((void*)cpu_set_ptr);
721+
free(cpu_set_ptr);
722722
end_error:
723723
*cpu_set = NULL;
724724
return error_no;
@@ -737,7 +737,7 @@ NdbThread_LockDestroyCPUSet(struct NdbCpuSet *cpu_set)
737737
#if defined HAVE_LINUX_SCHEDULING
738738
/* Empty */
739739
#elif defined HAVE_SOLARIS_AFFINITY
740-
pset_destroy((psetid_t*)cpu_set);
740+
pset_destroy(*((psetid_t*)cpu_set));
741741
#endif
742742
free(cpu_set);
743743
}
@@ -909,7 +909,7 @@ NdbThread_End()
909909

910910
if (g_main_thread)
911911
{
912-
NdbMem_Free((char *)g_main_thread);
912+
NdbMem_Free(g_main_thread);
913913
g_main_thread = 0;
914914
}
915915
}

0 commit comments

Comments
 (0)