[Groonga-commit] groonga/grngo at 3537b37 [master] Fix a bug that ctx.errbuf is used after closeCtx(ctx).

Back to archive index

susumu.yata null+****@clear*****
Wed Jun 24 17:01:43 JST 2015


susumu.yata	2015-06-24 17:01:43 +0900 (Wed, 24 Jun 2015)

  New Revision: 3537b379bf83a6e2aea870f3c04e3242bc33c247
  https://github.com/groonga/grngo/commit/3537b379bf83a6e2aea870f3c04e3242bc33c247

  Message:
    Fix a bug that ctx.errbuf is used after closeCtx(ctx).

  Modified files:
    grngo.go

  Modified: grngo.go (+2 -2)
===================================================================
--- grngo.go    2015-06-24 16:00:40 +0900 (a60e9ea)
+++ grngo.go    2015-06-24 17:01:43 +0900 (abb9801)
@@ -258,8 +258,8 @@ func CreateDB(path string) (*DB, error) {
 	}
 	obj := C.grn_db_create(ctx, cPath, nil)
 	if obj == nil {
-		closeCtx(ctx)
 		errMsg := C.GoString(&ctx.errbuf[0])
+		closeCtx(ctx)
 		return nil, fmt.Errorf("grn_db_create() failed: err = %s", errMsg)
 	}
 	return newDB(ctx, obj), nil
@@ -279,8 +279,8 @@ func OpenDB(path string) (*DB, error) {
 	defer C.free(unsafe.Pointer(cPath))
 	obj := C.grn_db_open(ctx, cPath)
 	if obj == nil {
-		closeCtx(ctx)
 		errMsg := C.GoString(&ctx.errbuf[0])
+		closeCtx(ctx)
 		return nil, fmt.Errorf("grn_db_open() failed: err = %s", errMsg)
 	}
 	return newDB(ctx, obj), nil
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index