Index: base/shell/cmd/assoc.c =================================================================== --- base/shell/cmd/assoc.c (revision 63193) +++ base/shell/cmd/assoc.c (working copy) @@ -66,6 +66,13 @@ fileType = cmd_alloc(fileTypeLength * sizeof(TCHAR)); + if (!fileType) + { + RegCloseKey(hKey); + RegCloseKey(hInsideKey); + return 0; + } + /* obtain actual file type */ return_val = RegQueryValueEx(hInsideKey, NULL, NULL, NULL, (LPBYTE) fileType, &fileTypeLength); @@ -83,7 +90,7 @@ ConOutPrintf(_T("%s=%s\n"), extension, fileType); } - if (fileTypeLength) + if (fileType) cmd_free(fileType); return 1; @@ -117,6 +124,12 @@ } extName = cmd_alloc(extLength * sizeof(TCHAR)); + + if (!extName) + { + RegCloseKey(hKey); + return 0; + } for(keyCtr = 0; keyCtr < numKeys; keyCtr++) { @@ -223,6 +236,9 @@ { LPTSTR fileType = lpEqualSign + 1; LPTSTR extension = cmd_alloc((lpEqualSign - param + 1) * sizeof(TCHAR)); + + if (!extension) + return 0; _tcsncpy(extension, param, lpEqualSign - param); extension[lpEqualSign - param] = (TCHAR)0;