vbox的更動 18221 路徑 trunk/src/VBox/Main/cbinding
- 時間撮記:
- 2009-3-24 下午07:35:24 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/cbinding/VBoxXPCOMCGlue.c
r18185 r18221 31 31 * Header Files * 32 32 *******************************************************************************/ 33 #ifndef VBOX_WITH_XPCOM /** @todo Find libvirt define to test for! */34 # include <config.h>35 # include "memory.h"36 #endif /* !VBOX_WITH_XPCOM */37 38 33 #include <stdio.h> 39 34 #include <string.h> … … 57 52 #endif 58 53 59 #ifdef VBOX_WITH_XPCOM /** @todo Find libvirt define to test for! */60 # define VIR_ALLOC_N(a, b) ((a) = (char *)malloc(b))61 # define VIR_FREE(name) (free(name))62 #endif /* !VBOX_WITH_XPCOM */63 64 54 65 55 /******************************************************************************* … … 86 76 { 87 77 size_t cchHome = pszHome ? strlen(pszHome) : 0; 88 size_t cbBuf; 78 size_t cbReq; 79 char szBuf[4096]; 89 80 char * pszBuf; 90 81 int rc = -1; … … 93 84 * Construct the full name. 94 85 */ 95 cbBuf = cchHome + sizeof("/" DYNLIB_NAME); 96 if(VIR_ALLOC_N(pszBuf, cbBuf)) {;} 97 if (!pszBuf) 98 { 99 sprintf(g_szVBoxErrMsg, "malloc(%u) failed", (unsigned)cbBuf); 86 cbReq = cchHome + sizeof("/" DYNLIB_NAME); 87 if (cbReq > sizeof(szBuf)) 88 { 89 sprintf(g_szVBoxErrMsg, "path buffer too small: %u bytes required", (unsigned)cbReq); 100 90 return -1; 101 91 } … … 142 132 else 143 133 sprintf(g_szVBoxErrMsg, "dlopen(%.80s): %128s", pszBuf, dlerror()); 144 VIR_FREE(pszBuf);145 134 return rc; 146 135 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器